From 5335c375c127e8d2b36e88f79026a10a29f90f55 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(-) (limited to 'src/quick') diff --git a/src/quick/util/qquickdeliveryagent.cpp b/src/quick/util/qquickdeliveryagent.cpp index 90c9f11dd9..894f52ce3d 100644 --- a/src/quick/util/qquickdeliveryagent.cpp +++ b/src/quick/util/qquickdeliveryagent.cpp @@ -2401,8 +2401,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