From 570d0e55b6bb77bd2da49704693dbcf0e2e7cb54 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 12 Jan 2016 14:01:51 +0100 Subject: [PATCH] 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 --- src/kitemviews/kitemlistcontainer.cpp | 4 ++-- src/kitemviews/private/kitemlistsmoothscroller.cpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp index c9d521ce78..94b49dbdec 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 2bd467aa53..c89d3cf8f8 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)) {