X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/148282e2d856b47ceb191eeef4c834118c8cdffd..d2fbbd44b422cc64ad184886670ca22df9dced5b:/src/dolphiniconsview.cpp diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index b95de351a..d30ef321e 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -43,6 +43,7 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle m_enableScrollTo(false), m_controller(controller), m_selectionManager(0), + m_autoScroller(0), m_categoryDrawer(0), m_font(), m_decorationSize(), @@ -62,7 +63,7 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle viewport()->setAcceptDrops(true); setMouseTracking(true); - new DolphinViewAutoScroller(this); + m_autoScroller = new DolphinViewAutoScroller(this); connect(this, SIGNAL(clicked(const QModelIndex&)), controller, SLOT(requestTab(const QModelIndex&))); @@ -277,10 +278,10 @@ void DolphinIconsView::wheelEvent(QWheelEvent* event) event->ignore(); return; } - + horizontalScrollBar()->setSingleStep(m_itemSize.width() / 10); verticalScrollBar()->setSingleStep(m_itemSize.height() / 10); - + KCategorizedView::wheelEvent(event); // if the icons are aligned left to right, the vertical wheel event should // be applied to the horizontal scrollbar @@ -314,6 +315,14 @@ void DolphinIconsView::leaveEvent(QEvent* event) m_controller->emitViewportEntered(); } +void DolphinIconsView::currentChanged(const QModelIndex& current, const QModelIndex& previous) +{ + KCategorizedView::currentChanged(current, previous); + if (current.isValid() && !m_autoScroller->isActive()) { + scrollTo(current); + } +} + void DolphinIconsView::slotShowPreviewChanged() { const DolphinView* view = m_controller->dolphinView();