aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickwindow.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2017-02-16 10:48:37 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2017-02-23 18:26:46 +0000
commit59c753bc75c7cfd4068fbbba3c25e1f54c46f4c0 (patch)
tree8998c236fe9ac9796a0b05f1501b2442b6d5c02a /src/quick/items/qquickwindow.cpp
parente53510944169ac9f6753e0d14e1b24a24ff7bd9a (diff)
QQuickWindowPrivate::deliverTouchCancelEvent: deliver to handlers too
Now that onGrabChanged() is unified, we have a means to tell the handler when it loses its grab due to a touch event being canceled. Change-Id: Idf3649242233ac7fb8c1fa80ad257ee14b861090 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r--src/quick/items/qquickwindow.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 0cd9357b9a..3089e3c2fa 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -1927,23 +1927,16 @@ bool QQuickWindowPrivate::deliverTouchCancelEvent(QTouchEvent *event)
Q_Q(QQuickWindow);
// A TouchCancel event will typically not contain any points.
- // Deliver it to all items that have active touches.
+ // Deliver it to all items and handlers that have active touches.
QQuickPointerEvent *pointerEvent = QQuickPointerDevice::touchDevice(event->device())->pointerEvent();
- QVector<QObject *> grabbers = pointerEvent->exclusiveGrabbers();
-
- for (QObject *grabber: qAsConst(grabbers)) {
- if (QQuickItem *grabberItem = qmlobject_cast<QQuickItem *>(grabber))
- QCoreApplication::sendEvent(grabberItem, event);
- else //if (QQuickPointerHandler *grabberHandler = qmlobject_cast<QQuickPointerHandler *>(grabber))
-// grabberHandler->handlePointerEvent()
- qWarning("unexpected: can't deliver touch cancel to a PointerHandler (yet?)");
- }
+ 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.
+ // The next touch event can only be a TouchBegin, so clean up.
pointerEvent->clearGrabbers();
return true;
}