From ca2b034c820b9e3944e3b47e1f7a732aa1450235 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 12 Dec 2022 12:26:01 +0100 Subject: Don't override exclusive touch grab of filtered item A parent that filters mouse/touch events for a child might make the child the exclusive grabber of the touch point when filtering, and the child might have the keepTouchGrab property set. In that case, don't override the exclusive grabber with the filtering parent. Task-number: QTBUG-105312 Change-Id: Ic04513987d5ecb2cd0b12939b7d66091e85b35ee Reviewed-by: Shawn Rutledge (cherry picked from commit f15f1d643ebf70fe9d3c67ea8405d819da595b21) Reviewed-by: Qt Cherry-pick Bot --- src/quick/util/qquickdeliveryagent.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/quick/util/qquickdeliveryagent.cpp b/src/quick/util/qquickdeliveryagent.cpp index 368de7c28d..97ca80dc78 100644 --- a/src/quick/util/qquickdeliveryagent.cpp +++ b/src/quick/util/qquickdeliveryagent.cpp @@ -2450,8 +2450,11 @@ bool QQuickDeliveryAgentPrivate::sendFilteredPointerEventImpl(QPointerEvent *eve if (filteringParent->childMouseEventFilter(receiver, &filteringParentTouchEvent)) { qCDebug(lcTouch) << "touch event intercepted by childMouseEventFilter of " << filteringParent; skipDelivery.append(filteringParent); - for (auto point : filteringParentTouchEvent.points()) - event->setExclusiveGrabber(point, filteringParent); + for (auto point : filteringParentTouchEvent.points()) { + const QQuickItem *exclusiveGrabber = qobject_cast(event->exclusiveGrabber(point)); + if (!exclusiveGrabber || !exclusiveGrabber->keepTouchGrab()) + event->setExclusiveGrabber(point, filteringParent); + } return true; } else if (Q_LIKELY(QCoreApplication::testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents)) && !filteringParent->acceptTouchEvents()) { -- cgit v1.2.3