diff options
author | Daniel d'Andrada <daniel.dandrada@luxoft.com> | 2017-10-09 17:39:44 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-11-03 09:47:13 +0000 |
commit | 0821180dc833376a738742e33f728983b9ca6f84 (patch) | |
tree | 0f55d165cc3ef4e7811c0759625586a49a761108 /src/quick | |
parent | c143c790b7a6fceaac16492023090940c81acc42 (diff) |
Fix bug preventing ungrabMouse() on TouchCancel
The order matters. There won't be a mouseGrabberItem() after
the cancelExclusiveGrabImpl() call. So ungrab the mouse before
calling it, not after.
Task-number: QTBUG-63680
Change-Id: I81e03e079362c865e13792feb8c3af8cb3abedc8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 4210ba36ad..143c76cb1b 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -1976,15 +1976,16 @@ bool QQuickWindowPrivate::deliverTouchCancelEvent(QTouchEvent *event) qCDebug(DBG_TOUCH) << event; Q_Q(QQuickWindow); + if (q->mouseGrabberItem()) + q->mouseGrabberItem()->ungrabMouse(); + touchMouseId = -1; + touchMouseDevice = nullptr; + // A TouchCancel event will typically not contain any points. // Deliver it to all items and handlers that have active touches. QQuickPointerEvent *pointerEvent = pointerEventInstance(QQuickPointerDevice::touchDevice(event->device())); for (int i = 0; i < pointerEvent->pointCount(); ++i) pointerEvent->point(i)->cancelExclusiveGrabImpl(event); - touchMouseId = -1; - touchMouseDevice = nullptr; - if (q->mouseGrabberItem()) - q->mouseGrabberItem()->ungrabMouse(); // The next touch event can only be a TouchBegin, so clean up. pointerEvent->clearGrabbers(); |