diff options
author | Jan Arve Sæther <jan-arve.saether@qt.io> | 2018-05-22 14:59:08 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-08-02 17:48:14 +0000 |
commit | ea195452e80e4b5a70e8c8cdf96a30581a8dd456 (patch) | |
tree | e92198b486164f3373364461842bb77ad9bead33 /tests/auto/quick/pointerhandlers/multipointtoucharea_interop | |
parent | fe1a259be66835bc937890f3ed62bb2e8496d0f1 (diff) |
Make pinch handler not activate on dragging
..when dragging (translation) is disabled
In order to do this, we had to integrate QQuickAxis to the PinchHandler
which allows enabling/disabling x and y axis individually.
This allows us to have one item with PinchHandler with translation
disabled (but to only handle rotate and scale) together with a two-finger
drag handler.
Change-Id: I1581c575ffba2e5d007163bec36e5699bdd86cbc
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/quick/pointerhandlers/multipointtoucharea_interop')
2 files changed, 11 insertions, 4 deletions
diff --git a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/data/pinchDragMPTA.qml b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/data/pinchDragMPTA.qml index f841b45431..f1591a412e 100644 --- a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/data/pinchDragMPTA.qml +++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/data/pinchDragMPTA.qml @@ -93,6 +93,7 @@ Rectangle { id: dragHandler objectName: "DragHandler" target: container + grabPermissions: PointerHandler.CanTakeOverFromItems } PinchHandler { id: pinch3 @@ -101,6 +102,7 @@ Rectangle { minimumPointCount: 3 minimumScale: 0.1 maximumScale: 10 + grabPermissions: PointerHandler.CanTakeOverFromItems } } } diff --git a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp index 5ea5a42044..1c95bb57b4 100644 --- a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp +++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp @@ -188,10 +188,15 @@ void tst_MptaInterop::touchesThenPinch() // Start moving: PinchHandler steals the exclusive grab from MPTA as soon as dragThreshold is exceeded int pinchStoleGrab = 0; - for (int i = 0; i < 8; ++i) { - p1 += QPoint(dragThreshold / 2, dragThreshold / 2); - p2 += QPoint(dragThreshold / 2, dragThreshold / 2); - p3 += QPoint(-dragThreshold / 2, dragThreshold / 2); + + const QPointF c = (p1 + p2 + p3)/3; // centroid of p1,p2,p3 + QTransform xform; // transform to rotate around the centroid + xform.translate(c.x(), c.y()).rotate(1).translate(-c.x(), -c.y()); + + for (int i = 0; i < 16; ++i) { + p1 = xform.map(p1); + p2 = xform.map(p2); + p3 = xform.map(p3); touch.move(1, p1).move(2, p2).move(3, p3).commit(); QQuickTouchUtils::flush(window); if (!pinchStoleGrab && pointerEvent->point(0)->exclusiveGrabber() == pinch) { |