diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-03-07 17:10:43 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-03-08 13:11:23 +0000 |
commit | 3b3c8103496f61ebc4b72e73035a4d43fcdd03b0 (patch) | |
tree | 76bcd2a06da851b94984a50a4e137155bfac682c /src/quick/handlers | |
parent | 54bb88bc99a0ea3966b6bde2ba06e4ece237a32c (diff) |
PointerHandlers: fix some grab notification and signal order problems
The singlePointHandlerProperties manual test showed how this was broken
in a couple of ways after 8c659c6c723e4f5f97f46a4555a4765e85c26f1d :
- When QQuickPointerTouchEvent::reset() is swapping one point instance
for another, and consequently transferring the grabbers from one to
another, it should not cause onGrabChanged to occur. Every point
update was triggering DragHandler.onGrabChanged.
- The order of signal emission is important so that sceneGrabPos
will be correct in onGrabChanged.
Change-Id: I62a302d6e54126ae10834b6d622e82aa0e434bab
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/handlers')
-rw-r--r-- | src/quick/handlers/qquickpointersinglehandler.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/quick/handlers/qquickpointersinglehandler.cpp b/src/quick/handlers/qquickpointersinglehandler.cpp index d9a9d692ae..112c680d3c 100644 --- a/src/quick/handlers/qquickpointersinglehandler.cpp +++ b/src/quick/handlers/qquickpointersinglehandler.cpp @@ -148,15 +148,17 @@ bool QQuickPointerSingleHandler::wantsEventPoint(QQuickEventPoint *point) void QQuickPointerSingleHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point) { - QQuickPointerHandler::onGrabChanged(grabber, stateChange, point); if (grabber != this) return; switch (stateChange) { case QQuickEventPoint::GrabExclusive: + m_sceneGrabPos = point->sceneGrabPos(); setActive(true); - Q_FALLTHROUGH(); + QQuickPointerHandler::onGrabChanged(grabber, stateChange, point); + break; case QQuickEventPoint::GrabPassive: m_sceneGrabPos = point->sceneGrabPos(); + QQuickPointerHandler::onGrabChanged(grabber, stateChange, point); break; case QQuickEventPoint::OverrideGrabPassive: return; // don't emit @@ -165,6 +167,7 @@ void QQuickPointerSingleHandler::onGrabChanged(QQuickPointerHandler *grabber, QQ case QQuickEventPoint::CancelGrabPassive: case QQuickEventPoint::CancelGrabExclusive: // the grab is lost or relinquished, so the point is no longer relevant + QQuickPointerHandler::onGrabChanged(grabber, stateChange, point); reset(); break; } |