]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Take into account QApplication::wheelScrollLines() in wheel events
authorMarco Martin <notmart@gmail.com>
Tue, 12 Jan 2016 13:01:51 +0000 (14:01 +0100)
committerMarco Martin <notmart@gmail.com>
Tue, 12 Jan 2016 13:01:51 +0000 (14:01 +0100)
when setting a different "mouse wheel scrolls by" value in the
mouse kcm, the user expects every view to scroll more or less
accordingly (even if it's not strictlya text view)
This makes the scroll in dolphin take that into account

REVIEW:126718

src/kitemviews/kitemlistcontainer.cpp
src/kitemviews/private/kitemlistsmoothscroller.cpp

index c9d521ce788fabab56ea6ca943a14174bee9bc14..94b49dbdeca96da4aac42f8dadb8f3535b0ff82d 100644 (file)
@@ -194,12 +194,12 @@ void KItemListContainer::wheelEvent(QWheelEvent* event)
         }
     } else {
         const int numDegrees = event->angleDelta().y() / 8;
         }
     } else {
         const int numDegrees = event->angleDelta().y() / 8;
-        const int numSteps = numDegrees / 15;
+        const int numSteps = qApp->wheelScrollLines() * numDegrees / 15;
         if (event->modifiers().testFlag(Qt::ShiftModifier)) {
             const int scrollingDirection = numSteps > 0 ? 1 : -1;
             smoothScroller->scrollTo(scrollBar->value() - scrollBar->pageStep() * scrollingDirection);
         } else {
         if (event->modifiers().testFlag(Qt::ShiftModifier)) {
             const int scrollingDirection = numSteps > 0 ? 1 : -1;
             smoothScroller->scrollTo(scrollBar->value() - scrollBar->pageStep() * scrollingDirection);
         } else {
-            smoothScroller->scrollTo(scrollBar->value() - numSteps * scrollBar->pageStep() / 4);
+            smoothScroller->scrollTo(scrollBar->value() - numSteps * scrollBar->pageStep() / 12);
         }
     }
 
         }
     }
 
index 2bd467aa53833ea3d4e436dde4c7cc7597a56b01..c89d3cf8f8d64d9e9f33d805b1b28764bd8ae573 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "kitemlistsmoothscroller.h"
 
 
 #include "kitemlistsmoothscroller.h"
 
+#include <QApplication>
 #include <QEvent>
 #include <QPropertyAnimation>
 #include <QScrollBar>
 #include <QEvent>
 #include <QPropertyAnimation>
 #include <QScrollBar>
@@ -200,8 +201,8 @@ void KItemListSmoothScroller::handleWheelEvent(QWheelEvent* event)
         numPixels = event->pixelDelta().y();
     } else {
         const int numDegrees = event->angleDelta().y() / 8;
         numPixels = event->pixelDelta().y();
     } else {
         const int numDegrees = event->angleDelta().y() / 8;
-        const int numSteps = numDegrees / 15;
-        numPixels = numSteps * m_scrollBar->pageStep() / 4;
+        const int numSteps = qApp->wheelScrollLines() * numDegrees / 15;
+        numPixels = numSteps * m_scrollBar->pageStep() / 12;
     }
     int value = m_scrollBar->value();
     if (event->modifiers().testFlag(Qt::ShiftModifier)) {
     }
     int value = m_scrollBar->value();
     if (event->modifiers().testFlag(Qt::ShiftModifier)) {