┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshish Bansal <[email protected]>2015-05-06 15:47:18 +0530
committerAshish Bansal <[email protected]>2015-05-06 15:47:18 +0530
commit1fe148805dbe524645b352621bd42493d10988ff (patch)
tree18b0bcea20aa7b3e51984229ec74a84c533cec03
parentc1a2c0f1a76dd1df7109d11a9f511b8c33d85054 (diff)
Scroll by page if Shift Key is pressed
If shift key is pressed along with scroll, scroll up/down by whole page. REVIEW: 123596
-rw-r--r--src/kitemviews/kitemlistcontainer.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp
index f5c785a3e..c9d521ce7 100644
--- a/src/kitemviews/kitemlistcontainer.cpp
+++ b/src/kitemviews/kitemlistcontainer.cpp
@@ -186,11 +186,21 @@ void KItemListContainer::wheelEvent(QWheelEvent* event)
const QScrollBar* scrollBar = smoothScroller->scrollBar();
if (!event->pixelDelta().isNull()) {
const int numPixels = event->pixelDelta().y();
- smoothScroller->scrollTo(scrollBar->value() - numPixels);
+ 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;
- smoothScroller->scrollTo(scrollBar->value() - numSteps * scrollBar->pageStep() / 4);
+ 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();