aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-12-12 12:26:01 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-12-15 03:33:45 +0000
commitca2b034c820b9e3944e3b47e1f7a732aa1450235 (patch)
tree4dc2ce4d7063c3215d50524182b3c27620df4270
parent5af49e9a638593b12c4e72d02a0930e1578b3009 (diff)
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 <shawn.rutledge@qt.io> (cherry picked from commit f15f1d643ebf70fe9d3c67ea8405d819da595b21) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quick/util/qquickdeliveryagent.cpp7
1 files 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<const QQuickItem *>(event->exclusiveGrabber(point));
+ if (!exclusiveGrabber || !exclusiveGrabber->keepTouchGrab())
+ event->setExclusiveGrabber(point, filteringParent);
+ }
return true;
} else if (Q_LIKELY(QCoreApplication::testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents)) &&
!filteringParent->acceptTouchEvents()) {