aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickpathview.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-09-05 13:57:19 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2019-09-23 17:56:44 +0200
commite2df4233a77ce8a37d2c8ef26b7b42fc0d33a24b (patch)
tree5252ce089575ebda7228fdb6ec2f4d1819a8adb9 /src/quick/items/qquickpathview.cpp
parent5c7e326802725a32a2426a4c1a07225c28da9af3 (diff)
PathView: grab mouse on press if already moving
A side effect of 8fd398c9d2f5f54e446e0b402bc63a2edb50da6f is that it became possible for the highlight to stop between items, rather than snapping to a specific item, if the user taps, clicks or drags an additional time while the movement is ongoing. That was because it didn't get a mouse grab, so it missed the release event. QQuickPathViewPrivate::handleMouseReleaseEvent() needs to take care of the snapping behavior after the user stops dragging. This only affects behavior in the case that the PathView is already moving and the mouse is pressed again: we assume the user wants to alter the PathView's velocity, not interact with any delegate inside or with any parent item. Task-number: QTBUG-77173 Task-number: QTBUG-59620 Change-Id: I7b2f69a6ef8d8022d7c917a5bf9e8fb40c8848db Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quick/items/qquickpathview.cpp')
-rw-r--r--src/quick/items/qquickpathview.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index 01b16cf41f..6976665134 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -1683,11 +1683,12 @@ void QQuickPathViewPrivate::handleMousePressEvent(QMouseEvent *event)
return;
}
-
- if (tl.isActive() && flicking && flickDuration && qreal(tl.time())/flickDuration < 0.8)
+ if (tl.isActive() && flicking && flickDuration && qreal(tl.time()) / flickDuration < 0.8) {
stealMouse = true; // If we've been flicked then steal the click.
- else
+ q->grabMouse(); // grab it right now too, just to be sure (QTBUG-77173)
+ } else {
stealMouse = false;
+ }
q->setKeepMouseGrab(stealMouse);
timer.start();