diff options
| author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-12-09 01:01:09 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-12-09 12:22:24 +0000 |
| commit | 8182a8044f3b9e6c25c3b50b1c7f34d2900a3207 (patch) | |
| tree | 22489011cb506ada47b8a71d403d3f128bad4f10 /src/quick/handlers/qquickpointerhandler.cpp | |
| parent | 3c4247e1e021b6bcc480afc0716e0231575d0501 (diff) | |
| parent | 51e02fdc02c3cc2dbf9d2ba0b3fb709a6cd4e32e (diff) | |
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
src/qml/common/qv4compileddata_p.h
Change-Id: I1150c8cd0161f0e22137d383013751394ae64e18
Diffstat (limited to 'src/quick/handlers/qquickpointerhandler.cpp')
| -rw-r--r-- | src/quick/handlers/qquickpointerhandler.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/quick/handlers/qquickpointerhandler.cpp b/src/quick/handlers/qquickpointerhandler.cpp index 9d4fae1a71..bf30ef5658 100644 --- a/src/quick/handlers/qquickpointerhandler.cpp +++ b/src/quick/handlers/qquickpointerhandler.cpp @@ -268,8 +268,25 @@ bool QQuickPointerHandler::approveGrabTransition(QQuickEventPoint *point, QObjec } else if ((d->grabPermissions & CanTakeOverFromItems)) { QQuickItem * existingItemGrabber = point->grabberItem(); if (existingItemGrabber && !((existingItemGrabber->keepMouseGrab() && point->pointerEvent()->asPointerMouseEvent()) || - (existingItemGrabber->keepTouchGrab() && point->pointerEvent()->asPointerTouchEvent()))) + (existingItemGrabber->keepTouchGrab() && point->pointerEvent()->asPointerTouchEvent()))) { allowed = true; + // If the handler wants to steal the exclusive grab from an Item, the Item can usually veto + // by having its keepMouseGrab flag set. But an exception is if that Item is a parent that + // normally filters events (such as a Flickable): it needs to be possible for e.g. a + // DragHandler to operate on an Item inside a Flickable. Flickable is aggressive about + // grabbing on press (for fear of missing updates), but DragHandler uses a passive grab + // at first and then expects to be able to steal the grab later on. It cannot respect + // Flickable's wishes in that case, because then it would never have a chance. + if (existingItemGrabber->keepMouseGrab() && + !(existingItemGrabber->filtersChildMouseEvents() && existingItemGrabber->isAncestorOf(parentItem()))) { + QQuickWindowPrivate *winPriv = QQuickWindowPrivate::get(parentItem()->window()); + if (winPriv->isDeliveringTouchAsMouse() && point->pointId() == winPriv->touchMouseId) { + qCDebug(lcPointerHandlerGrab) << this << "wants to grab touchpoint" << point->pointId() + << "but declines to steal grab from touch-mouse grabber with keepMouseGrab=true" << existingItemGrabber; + allowed = false; + } + } + } } } } else { |
