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
This commit is contained in:
Marco Martin 2016-01-12 14:01:51 +01:00
parent a3acc36a66
commit 570d0e55b6
2 changed files with 5 additions and 4 deletions

View file

@ -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);
}
}

View file

@ -19,6 +19,7 @@
#include "kitemlistsmoothscroller.h"
#include <QApplication>
#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;
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)) {