diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-12-12 12:26:01 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-12-16 18:45:57 +0100 |
commit | 5335c375c127e8d2b36e88f79026a10a29f90f55 (patch) | |
tree | 9679cf8c87134d7124f4fd5fe6c9d330f2d524da /src/quick | |
parent | bad34b4d7c27219b94c7eccc16e57a06b8907fcd (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>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/util/qquickdeliveryagent.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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<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()) { |