aboutsummaryrefslogtreecommitdiffstats
path: root/src
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-25 11:37:11 +0200
commit128ba80362be4e8cf13147307eb9c652c4b5f124 (patch)
treeba52fd649bdc318214424e6343887d2b7b568d0f /src
parent2f16944d45e1ade14ad086a547a9673b1ceba7bc (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> (cherry picked from commit e2df4233a77ce8a37d2c8ef26b7b42fc0d33a24b)
Diffstat (limited to 'src')
-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 fd5814d2b2..d44b283e07 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -1653,11 +1653,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();