mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 01:40:02 +00:00
Scroll by page if Shift Key is pressed
If shift key is pressed along with scroll, scroll up/down by whole page. REVIEW: 123596
This commit is contained in:
parent
c1a2c0f1a7
commit
1fe148805d
|
@ -186,12 +186,22 @@ void KItemListContainer::wheelEvent(QWheelEvent* event)
|
|||
const QScrollBar* scrollBar = smoothScroller->scrollBar();
|
||||
if (!event->pixelDelta().isNull()) {
|
||||
const int numPixels = event->pixelDelta().y();
|
||||
if (event->modifiers().testFlag(Qt::ShiftModifier)) {
|
||||
const int scrollingDirection = numPixels > 0 ? 1 : -1;
|
||||
smoothScroller->scrollTo(scrollBar->value() - scrollBar->pageStep() * scrollingDirection);
|
||||
} else {
|
||||
smoothScroller->scrollTo(scrollBar->value() - numPixels);
|
||||
}
|
||||
} else {
|
||||
const int numDegrees = event->angleDelta().y() / 8;
|
||||
const int numSteps = 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);
|
||||
}
|
||||
}
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue