diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-07-04 13:28:51 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-07-05 15:02:17 +0200 |
commit | 42e403a51da3539cc5062fde13884678dba55b5a (patch) | |
tree | 4da74cfae9aee2e48c17789ae603697f4c2b8917 /src/quick | |
parent | 9a53834f1e7fce2fc3b1ecc2a311faedbc371d37 (diff) |
Notify QQItem::mouseUngrabEvent() when an Event Handler steals grab
We already took care of cases when the handler is a child of the Item,
grab transitions involving Flickable etc.; but the bug is about a simpler
case when the handler is in the parent of the item that has the grab,
and steals from it. Amends 38a016c7b1337d83d77879f45b4a2e6fec11d049
Fixes: QTBUG-71218
Fixes: QTBUG-75025
Change-Id: Id1d6d370e0db75c59ec7dce4a8e545701c501827
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquickevents.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index 28b217b7b3..8303c3fed1 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -913,10 +913,14 @@ void QQuickEventPoint::setGrabberPointerHandler(QQuickPointerHandler *grabber, b passiveGrabber->onGrabChanged(grabber, OverrideGrabPassive, this); } } - if (oldGrabberHandler) + if (oldGrabberHandler) { oldGrabberHandler->onGrabChanged(oldGrabberHandler, (grabber ? CancelGrabExclusive : UngrabExclusive), this); - else if (oldGrabberItem && pointerEvent()->asPointerTouchEvent()) - oldGrabberItem->touchUngrabEvent(); + } else if (oldGrabberItem) { + if (pointerEvent()->asPointerTouchEvent()) + oldGrabberItem->touchUngrabEvent(); + else if (pointerEvent()->asPointerMouseEvent()) + oldGrabberItem->mouseUngrabEvent(); + } // touchUngrabEvent() can result in the grabber being set to null (MPTA does that, for example). // So set it again to ensure that final state is what we want. m_exclusiveGrabber = QPointer<QObject>(grabber); |