From 22c00c7011c8d2005fe76a9969c072fa269bc3be Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 25 Sep 2020 14:12:31 +0200 Subject: 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 --- src/quick/items/qquickitem.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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(pg.first()); + Q_ASSERT(handler); + pointGrabber = handler->parentItem(); + } + } // filtering: (childMouseEventFilter) include points that are grabbed by children of the target item bool grabberIsChild = false; -- cgit v1.2.3