mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
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:
parent
a3acc36a66
commit
570d0e55b6
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Reference in a new issue