aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/pointer/map.qml
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-06-11 07:38:46 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2018-07-19 10:56:06 +0000
commitca7cdd71ee33f0d77eb6bf1367d2532e26155cb2 (patch)
treeaf1b30bffea87bedb23e8cd795f23692f29b50a9 /tests/manual/pointer/map.qml
parentd310ca768bb5f45bae4fcec9a5d8151b6a366b8d (diff)
Make DragHandler a MultiPointHandler
That is, minimumPointCount can now be set to a value > 1 to require multiple fingers to do the dragging, or to track the displacement of multiple fingers to adjust some value (such as the tilt of a map). Task-number: QTBUG-68106 Change-Id: Ib35823e36deb81c8b277d3070fcc758c7c019564 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'tests/manual/pointer/map.qml')
-rw-r--r--tests/manual/pointer/map.qml14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/manual/pointer/map.qml b/tests/manual/pointer/map.qml
index ae7ec042d3..3ed732b523 100644
--- a/tests/manual/pointer/map.qml
+++ b/tests/manual/pointer/map.qml
@@ -39,6 +39,7 @@ Item {
y: (parent.height - height) / 2
width: image.width
height: image.height
+ transform: Rotation { id: tilt; origin.x: width / 2; origin.y: height / 2; axis { x: 1; y: 0; z: 0 } }
Image {
id: image
@@ -57,16 +58,29 @@ Item {
PinchHandler {
id: pinch
+ objectName: "two-point pinch"
target: map
minimumScale: 0.1
maximumScale: 10
onActiveChanged: if (!active) reRenderIfNecessary()
+ grabPermissions: PinchHandler.TakeOverForbidden // don't allow takeover if pinch has started
}
DragHandler {
+ objectName: "single-point drag"
target: map
}
+ DragHandler {
+ id: tiltHandler
+ objectName: "two-point tilt"
+ minimumPointCount: 2
+ maximumPointCount: 2
+ xAxis.enabled: false
+ target: null
+ onTranslationChanged: tilt.angle = translation.y / -2
+ }
+
function reRenderIfNecessary() {
var newSourceWidth = image.sourceSize.width * pinch.scale
var ratio = newSourceWidth / image.sourceSize.width