diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-02-16 10:48:37 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-02-23 18:26:46 +0000 |
commit | 59c753bc75c7cfd4068fbbba3c25e1f54c46f4c0 (patch) | |
tree | 8998c236fe9ac9796a0b05f1501b2442b6d5c02a /src/quick/items/qquickevents.cpp | |
parent | e53510944169ac9f6753e0d14e1b24a24ff7bd9a (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/qquickevents.cpp')
-rw-r--r-- | src/quick/items/qquickevents.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index a7ab0f01b0..bbea32f905 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -681,16 +681,26 @@ void QQuickEventPoint::setGrabberPointerHandler(QQuickPointerHandler *grabber, b */ void QQuickEventPoint::cancelExclusiveGrab() { - if (m_exclusiveGrabber.isNull()) { + if (m_exclusiveGrabber.isNull()) qWarning("cancelGrab: no grabber"); + else + cancelExclusiveGrabImpl(); +} + +void QQuickEventPoint::cancelExclusiveGrabImpl(QTouchEvent *cancelEvent) +{ + if (m_exclusiveGrabber.isNull()) return; - } if (Q_UNLIKELY(lcPointerGrab().isDebugEnabled())) { qCDebug(lcPointerGrab) << pointDeviceName(this) << "point" << hex << m_pointId << pointStateString(this) << ": grab (exclusive)" << m_exclusiveGrabber << "-> nullptr"; } - if (auto handler = grabberPointerHandler()) + if (auto handler = grabberPointerHandler()) { handler->onGrabChanged(handler, CancelGrabExclusive, this); + } else if (auto item = grabberItem()) { + if (cancelEvent) + QCoreApplication::sendEvent(item, cancelEvent); + } m_exclusiveGrabber.clear(); } |