Commit 8ae95b29 authored by Alex Rosca's avatar Alex Rosca Committed by David Hurka
Browse files

Avoid unintentional accelerating flicks by reducing maximum flick time

When making a flick using the mouse or the touchscreen and then slowly
dragging the pages in the same direction with the flick, it unintentionally
reenters the flicking state after a mouse button release and it's quite
annoying. The commit reduces the maximum time before the next flick.

Steps to reproduce:
1) Flick in direction A.
2) While the view is coasting, decide that you want to stop close to the current position.
3) Grab the view (still coasting), and drag it slowly in direction A.
4) When you reached the desired point, stop your movement, and release the view.
5) QScroller interprets this release as “accelerating flick”,
   and makes the view coast faster in direction A.

Upstream bug is QTBUG-88249; QScroller ignores MinimumVelocity for accelerating flicks.
parent 19d5dd8e
......@@ -429,6 +429,7 @@ PageView::PageView(QWidget *parent, Okular::Document *document)
QScrollerProperties prop;
prop.setScrollMetric(QScrollerProperties::DecelerationFactor, 0.3);
prop.setScrollMetric(QScrollerProperties::MaximumVelocity, 1);
prop.setScrollMetric(QScrollerProperties::AcceleratingFlickMaximumTime, 0.2); // Workaround for QTBUG-88249 (non-flick gestures recognized as accelerating flick)
prop.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff);
prop.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff);
prop.setScrollMetric(QScrollerProperties::DragStartDistance, 0.0);
Supports Markdown
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