]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphiniconsview.cpp
provide separate scroll increments for the horizontal and vertical scrolling
[dolphin.git] / src / dolphiniconsview.cpp
index b95de351a8c6abf6812ac375d0651bc7508bf60a..2e43656babfccfb125860b3b4861b82a99930a11 100644 (file)
@@ -277,10 +277,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 +314,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()) {
+        scrollTo(current);
+    }
+}
+
 void DolphinIconsView::slotShowPreviewChanged()
 {
     const DolphinView* view = m_controller->dolphinView();