From: Marco Martin Date: Tue, 12 Jan 2016 13:01:51 +0000 (+0100) Subject: Take into account QApplication::wheelScrollLines() in wheel events X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/570d0e55b6bb77bd2da49704693dbcf0e2e7cb54 Take into account QApplication::wheelScrollLines() in wheel events 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 --- diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp index c9d521ce7..94b49dbde 100644 --- a/src/kitemviews/kitemlistcontainer.cpp +++ b/src/kitemviews/kitemlistcontainer.cpp @@ -194,12 +194,12 @@ void KItemListContainer::wheelEvent(QWheelEvent* event) } } 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 { - smoothScroller->scrollTo(scrollBar->value() - numSteps * scrollBar->pageStep() / 4); + smoothScroller->scrollTo(scrollBar->value() - numSteps * scrollBar->pageStep() / 12); } } diff --git a/src/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp index 2bd467aa5..c89d3cf8f 100644 --- a/src/kitemviews/private/kitemlistsmoothscroller.cpp +++ b/src/kitemviews/private/kitemlistsmoothscroller.cpp @@ -19,6 +19,7 @@ #include "kitemlistsmoothscroller.h" +#include #include #include #include @@ -200,8 +201,8 @@ void KItemListSmoothScroller::handleWheelEvent(QWheelEvent* event) 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)) {