]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistcontainer.cpp
Merge branch 'Applications/16.08'
[dolphin.git] / src / kitemviews / kitemlistcontainer.cpp
index 46ac4745e70fa6ab9c3825fe7e6b5f67ed7846e7..6974ebb483ca55c5c678095686858f1a02cfb762 100644 (file)
@@ -35,7 +35,6 @@
 #include <QStyle>
 #include <QStyleOption>
 
-#include <KDebug>
 
 /**
  * Replaces the default viewport of KItemListContainer by a
@@ -44,6 +43,8 @@
  */
 class KItemListContainerViewport : public QGraphicsView
 {
+    Q_OBJECT
+
 public:
     KItemListContainerViewport(QGraphicsScene* scene, QWidget* parent);
 protected:
@@ -184,17 +185,7 @@ void KItemListContainer::wheelEvent(QWheelEvent* event)
     KItemListSmoothScroller* smoothScroller = scrollHorizontally ?
                                               m_horizontalSmoothScroller : m_verticalSmoothScroller;
 
-    const QScrollBar* scrollBar = smoothScroller->scrollBar();
-    if (!event->pixelDelta().isNull()) {
-        const int numPixels =  event->pixelDelta().y();
-        smoothScroller->scrollTo(scrollBar->value() - numPixels);
-    } else {
-        const int numDegrees = event->angleDelta().y() / 8;
-        const int numSteps = numDegrees / 15;
-        smoothScroller->scrollTo(scrollBar->value() - numSteps * scrollBar->pageStep() / 4);
-    }
-
-    event->accept();
+    smoothScroller->handleWheelEvent(event);
 }
 
 void KItemListContainer::slotScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous)
@@ -416,3 +407,4 @@ void KItemListContainer::updateScrollOffsetScrollBarPolicy()
     }
 }
 
+#include "kitemlistcontainer.moc"