]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistcontainer.cpp
Merge branch 'davidedmundson/highdpi'
[dolphin.git] / src / kitemviews / kitemlistcontainer.cpp
index 765b366d1aa219e9f8dbadaec1ed5bc749022113..f5c785a3ee6432a53846d6e41dcf420600484ede 100644 (file)
 #include <QApplication>
 #include <QGraphicsScene>
 #include <QGraphicsView>
-#include <QPropertyAnimation>
 #include <QScrollBar>
 #include <QStyle>
 #include <QStyleOption>
 
-#include <KDebug>
 
 /**
  * Replaces the default viewport of KItemListContainer by a
@@ -185,11 +183,15 @@ void KItemListContainer::wheelEvent(QWheelEvent* event)
     KItemListSmoothScroller* smoothScroller = scrollHorizontally ?
                                               m_horizontalSmoothScroller : m_verticalSmoothScroller;
 
-    const int numDegrees = event->delta() / 8;
-    const int numSteps = numDegrees / 15;
-
     const QScrollBar* scrollBar = smoothScroller->scrollBar();
-    smoothScroller->scrollTo(scrollBar->value() - numSteps * scrollBar->pageStep() / 4);
+    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();
 }