aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quick/handlers/qquickmultipointerhandler.cpp15
-rw-r--r--src/quick/handlers/qquickmultipointerhandler_p.h2
-rw-r--r--src/quick/handlers/qquickpinchhandler.cpp4
-rw-r--r--tests/manual/touch/mpta-crosshairs.qml1
4 files changed, 16 insertions, 6 deletions
diff --git a/src/quick/handlers/qquickmultipointerhandler.cpp b/src/quick/handlers/qquickmultipointerhandler.cpp
index 1a5684d80e..016210beff 100644
--- a/src/quick/handlers/qquickmultipointerhandler.cpp
+++ b/src/quick/handlers/qquickmultipointerhandler.cpp
@@ -238,10 +238,19 @@ void QQuickMultiPointerHandler::acceptPoints(const QVector<QQuickEventPoint *> &
point->setAccepted();
}
-void QQuickMultiPointerHandler::grabPoints(QVector<QQuickEventPoint *> points)
+bool QQuickMultiPointerHandler::grabPoints(QVector<QQuickEventPoint *> points)
{
- for (QQuickEventPoint* point : points)
- setExclusiveGrab(point);
+ bool canGrab = true;
+ for (QQuickEventPoint* point : points) {
+ auto grabber = point->grabberItem();
+ if (grabber && (grabber->keepMouseGrab() || grabber->keepTouchGrab()))
+ canGrab = false;
+ }
+ if (canGrab) {
+ for (QQuickEventPoint* point : points)
+ setExclusiveGrab(point);
+ }
+ return canGrab;
}
QT_END_NAMESPACE
diff --git a/src/quick/handlers/qquickmultipointerhandler_p.h b/src/quick/handlers/qquickmultipointerhandler_p.h
index be92a39631..ce014d658c 100644
--- a/src/quick/handlers/qquickmultipointerhandler_p.h
+++ b/src/quick/handlers/qquickmultipointerhandler_p.h
@@ -98,7 +98,7 @@ protected:
QVector<PointData> angles(const QPointF &ref) const;
static qreal averageAngleDelta(const QVector<PointData> &old, const QVector<PointData> &newAngles);
void acceptPoints(const QVector<QQuickEventPoint *> &points);
- void grabPoints(QVector<QQuickEventPoint *> points);
+ bool grabPoints(QVector<QQuickEventPoint *> points);
protected:
QVector<QQuickEventPoint *> m_currentPoints;
diff --git a/src/quick/handlers/qquickpinchhandler.cpp b/src/quick/handlers/qquickpinchhandler.cpp
index 67d32cdb18..3af77593e2 100644
--- a/src/quick/handlers/qquickpinchhandler.cpp
+++ b/src/quick/handlers/qquickpinchhandler.cpp
@@ -232,8 +232,8 @@ void QQuickPinchHandler::handlePointerEventImpl(QQuickPointerEvent *event)
// Verify that least one of the points have moved beyond threshold needed to activate the handler
for (QQuickEventPoint *point : qAsConst(m_currentPoints)) {
if (QQuickWindowPrivate::dragOverThreshold(point)) {
- grabPoints(m_currentPoints);
- setActive(true);
+ if (grabPoints(m_currentPoints))
+ setActive(true);
break;
}
}
diff --git a/tests/manual/touch/mpta-crosshairs.qml b/tests/manual/touch/mpta-crosshairs.qml
index d1dbd0f188..efea16029b 100644
--- a/tests/manual/touch/mpta-crosshairs.qml
+++ b/tests/manual/touch/mpta-crosshairs.qml
@@ -50,6 +50,7 @@ Rectangle {
MultiPointTouchArea {
id: mpta
anchors.fill: parent
+ //onGestureStarted: gesture.grab() // in case this is embedded in something that might steal
touchPoints: [
TouchPoint { property color color: "red" },
TouchPoint { property color color: "orange" },