aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-09-25 14:12:31 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-09-28 13:47:29 +0200
commit22c00c7011c8d2005fe76a9969c072fa269bc3be (patch)
treeeba768b548bf434b1e8483cf771fe4e1f911e5f7 /src/quick
parent709f30f1a83c9c65b82f689fc67cd23fc2ba9696 (diff)
QQItemPriv::localizedTouchEvent: don't skip parents of passive grabbers
Some subtests of tst_FlickableInterop::touchAndDragHandlerOnFlickable() check whether Flickable can continue to filter child mouse events, even when the only thing going on is that we are delivering a TouchUpdate QTouchEvent to a TapHandler inside the Flickable's content item (such as inside a ListView delegate) due to its having a passive grab. So during filtering only, localizedTouchEvent() needs to localize the event for any item that has passive grabbers somewhere in its children. Change-Id: Icff0438ddba97bd916feedc9dcd6a71ae47671e5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/qquickitem.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index d482dcdfca..ac0d4389e1 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -8395,6 +8395,18 @@ QTouchEvent QQuickItemPrivate::localizedTouchEvent(const QTouchEvent *event, boo
const auto localPos = q->mapFromScene(p.scenePosition());
bool isInside = q->contains(localPos);
bool hasAnotherGrabber = pointGrabber && pointGrabber != q;
+ // if there's no exclusive grabber, look for passive grabbers during filtering
+ if (isFiltering && !pointGrabber) {
+ auto pg = event->passiveGrabbers(p);
+ if (!pg.isEmpty()) {
+ // It seems unlikely to have multiple passive grabbers of one eventpoint with different grandparents.
+ // So hopefully if we start from one passive grabber and go up the parent chain from there,
+ // we will find any filtering parent items that exist.
+ auto handler = qmlobject_cast<QQuickPointerHandler *>(pg.first());
+ Q_ASSERT(handler);
+ pointGrabber = handler->parentItem();
+ }
+ }
// filtering: (childMouseEventFilter) include points that are grabbed by children of the target item
bool grabberIsChild = false;