From a7d97ca9b05b8078f00767f844044ed0de333a6a Mon Sep 17 00:00:00 2001 From: Lauri Laanmets Date: Sun, 22 May 2022 14:37:44 +0300 Subject: Improve QEvent::UngrabMouse handling in map gesture area Replace deprecated QQuickWindow::mouseGrabberItem() check and pass on all QEvent::UngrabMouse events into general 'QQuickGeoMapGestureArea::handleTouchEvent' handler. This will handle 'exclusiveGrabber' and 'QEventPoint::Released' events separately for all points. This will now correctly handle the situation where child MouseArea: 1. Grabs first touch point with 'press and hold' 2. Second finger is pressed. 3. First finger is released and 'ungrabbed'. 4. Second finger will start panning the map. Task-number: QTBUG-96795 Change-Id: Ieb3418787e89aadd1a7c0c8ab9b1f965a4484c24 Reviewed-by: Volker Hilsheimer (cherry picked from commit a94cefd446dd192172f47f183b56bbb719e95ee4) --- src/location/declarativemaps/qdeclarativegeomap.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp index 8a153deb..38c554f4 100644 --- a/src/location/declarativemaps/qdeclarativegeomap.cpp +++ b/src/location/declarativemaps/qdeclarativegeomap.cpp @@ -2575,19 +2575,9 @@ bool QDeclarativeGeoMap::childMouseEventFilter(QQuickItem *item, QEvent *event) } } break; - case QEvent::UngrabMouse: { - QQuickWindow *win = window(); - if (!win) break; - if (!win->mouseGrabberItem() || - (win->mouseGrabberItem() && - win->mouseGrabberItem() != this)) { - // child lost grab, we could even lost - // some events if grab already belongs for example - // in item in diffrent window , clear up states - mouseUngrabEvent(); - } - break; - } + case QEvent::UngrabMouse: + Q_ASSERT(event->isSinglePointEvent()); + return sendTouchEvent(static_cast(event)); default: break; } -- cgit v1.2.3