Commit 777ac37e authored by Nate Graham's avatar Nate Graham 💤
Browse files

Fix fast scrolling with Shift+Scroll

When holding down the shift key, multiply wheel and touchpad scroll
distances by 10 to re-implement the fast scrolling feature that
broke when we added animated/smooth scrolling.

BUG: 420889
FIXED-IN: 1.11.3
parent 8b008b02
Pipeline #38313 passed with stage
in 54 minutes and 23 seconds
...@@ -3126,16 +3126,19 @@ void PageView::wheelEvent(QWheelEvent *e) ...@@ -3126,16 +3126,19 @@ void PageView::wheelEvent(QWheelEvent *e)
d->scroller->scrollTo(QPoint(horizontalScrollBar()->value(), verticalScrollBar()->value()), 0); // sync scroller with scrollbar d->scroller->scrollTo(QPoint(horizontalScrollBar()->value(), verticalScrollBar()->value()), 0); // sync scroller with scrollbar
} }
} else { } else {
// When the shift key is held down, scroll ten times faster
int multiplier = e->modifiers() & Qt::ShiftModifier ? 10 : 1;
if (delta != 0 && delta % QWheelEvent::DefaultDeltasPerStep == 0) { if (delta != 0 && delta % QWheelEvent::DefaultDeltasPerStep == 0) {
// number of scroll wheel steps Qt gives to us at the same time // number of scroll wheel steps Qt gives to us at the same time
int count = abs(delta / QWheelEvent::DefaultDeltasPerStep); int count = abs(delta / QWheelEvent::DefaultDeltasPerStep) * multiplier;
if (delta < 0) { if (delta < 0) {
slotScrollDown(count); slotScrollDown(count);
} else { } else {
slotScrollUp(count); slotScrollUp(count);
} }
} else { } else {
d->scroller->scrollTo(d->scroller->finalPosition() - e->angleDelta() / 4.0, 0); d->scroller->scrollTo(d->scroller->finalPosition() - e->angleDelta() * multiplier / 4.0, 0);
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment