diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-09-05 13:57:19 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-10-09 13:08:17 +0200 |
commit | 26e99aeacdb2527e6b439d8244a774cd719d732a (patch) | |
tree | af50b6c1f47811133dc296b0a31977d3674d9a94 /src | |
parent | 290dc2da70655db9d4590600dfd37b825b81c1f8 (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.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index e4480b335a..8abb3f29cd 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -1680,11 +1680,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(); |