aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-12-09 01:01:09 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-12-09 12:22:24 +0000
commit8182a8044f3b9e6c25c3b50b1c7f34d2900a3207 (patch)
tree22489011cb506ada47b8a71d403d3f128bad4f10 /src/quick/handlers
parent3c4247e1e021b6bcc480afc0716e0231575d0501 (diff)
parent51e02fdc02c3cc2dbf9d2ba0b3fb709a6cd4e32e (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')
-rw-r--r--src/quick/handlers/qquickpointerhandler.cpp19
-rw-r--r--src/quick/handlers/qquicktaphandler.cpp9
2 files changed, 22 insertions, 6 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 {
diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp
index 272ebe6b63..f3674d6fa9 100644
--- a/src/quick/handlers/qquicktaphandler.cpp
+++ b/src/quick/handlers/qquicktaphandler.cpp
@@ -132,17 +132,16 @@ bool QQuickTapHandler::wantsEventPoint(QQuickEventPoint *point)
}
break;
case QQuickEventPoint::Stationary:
- // Never react in any way when the point hasn't moved.
- // In autotests, the point's position may not even be correct, because
- // QTest::touchEvent(window, touchDevice).stationary(1)
- // provides no opportunity to give a position, so it ends up being random.
+ // If the point hasn't moved since last time, the return value should be the same as last time.
+ // If we return false here, QQuickPointerHandler::handlePointerEvent() will call setActive(false).
+ ret = point->pointId() == this->point().id();
break;
}
// If this is the grabber, returning false from this function will cancel the grab,
// so onGrabChanged(this, CancelGrabExclusive, point) and setPressed(false) will be called.
// But when m_gesturePolicy is DragThreshold, we don't get an exclusive grab, but
// we still don't want to be pressed anymore.
- if (!ret && point->pointId() == this->point().id() && point->state() != QQuickEventPoint::Stationary)
+ if (!ret && point->pointId() == this->point().id())
setPressed(false, true, point);
return ret;
}