]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphindetailsview.cpp
as the detailsview and columnview can also have icon sizes up to 256 x 256 pixels...
[dolphin.git] / src / dolphindetailsview.cpp
index c4f54cec4da13e9af8bc9c41ae5efd6dfd136b0f..c81ec089c9d7d87335d44a42b5aa9b0cc2c497ab 100644 (file)
@@ -25,6 +25,7 @@
 #include "dolphinfileitemdelegate.h"
 #include "dolphinsettings.h"
 #include "dolphinsortfilterproxymodel.h"
+#include "dolphinviewautoscroller.h"
 #include "draganddrophelper.h"
 #include "selectionmanager.h"
 #include "viewproperties.h"
@@ -75,6 +76,7 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr
     setEditTriggers(QAbstractItemView::NoEditTriggers);
 
     setMouseTracking(true);
+    new DolphinViewAutoScroller(this);
 
     const ViewProperties props(controller->url());
     setSortIndicatorSection(props.sorting());
@@ -167,11 +169,6 @@ bool DolphinDetailsView::event(QEvent* event)
 
         hideColumn(DolphinModel::Rating);
         hideColumn(DolphinModel::Tags);
-    } else if (event->type() == QEvent::UpdateRequest) {
-        // a wheel movement will scroll 4 items
-        if (model()->rowCount() > 0) {
-            verticalScrollBar()->setSingleStep((sizeHintForRow(0) / 3) * 4);
-        }
     }
 
     return QTreeView::event(event);
@@ -417,7 +414,10 @@ void DolphinDetailsView::wheelEvent(QWheelEvent* event)
         event->ignore();
         return;
     }
-
+    
+    const int height = m_decorationSize.height();
+    const int step = (height >= KIconLoader::SizeHuge) ? height / 10 : (KIconLoader::SizeHuge - height) / 2;
+    verticalScrollBar()->setSingleStep(step);
     QTreeView::wheelEvent(event);
 }