aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-05-09 20:32:16 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2018-05-18 15:12:20 +0000
commit52d35526f256bf4c8155f5e660a214ab8a2efbdf (patch)
tree054111780d9f4c371d62d18bc8d50b1cea2d19e7 /tests/manual
parentd33d5a40483c6b56c3be19ce244f14938a5941a0 (diff)
MultiPointHandler: add a centroid property
One of the reasons we were so fond of using SinglePointHandler for the "simple" handlers like TapHandler and DragHandler is that it has the point property, which is easy to bind to in QML. But multi-point handlers tend to use the centroid as the focal point or fulcrum of the transformation, so exposing the centroid as a QQuickHandlerPoint gadget rather than just a QPointF has all the same advantages as the point property in SinglePointHandler, including letting the QQuickHandlerPoint instance store state between events (press position, grab position, last known position etc.) Change-Id: I4a955fa21b54b7ebb50b0ee2c942fb98eeccb560 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/pointer/pinchDragFlingMPTA.qml2
-rw-r--r--tests/manual/pointer/pinchHandler.qml6
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/manual/pointer/pinchDragFlingMPTA.qml b/tests/manual/pointer/pinchDragFlingMPTA.qml
index 2578d62466..0362832662 100644
--- a/tests/manual/pointer/pinchDragFlingMPTA.qml
+++ b/tests/manual/pointer/pinchDragFlingMPTA.qml
@@ -66,7 +66,7 @@ Rectangle {
minimumPointCount: 3
minimumScale: 0.1
maximumScale: 10
- onActiveChanged: if (!active) fling.restart(centroidVelocity)
+ onActiveChanged: if (!active) fling.restart(centroid.velocity)
}
DragHandler {
id: dragHandler
diff --git a/tests/manual/pointer/pinchHandler.qml b/tests/manual/pointer/pinchHandler.qml
index 409b852b55..36af1f53bd 100644
--- a/tests/manual/pointer/pinchHandler.qml
+++ b/tests/manual/pointer/pinchHandler.qml
@@ -153,7 +153,7 @@ Rectangle {
maximumScale: 10
onActiveChanged: {
if (!active)
- anim.restart(centroidVelocity)
+ anim.restart(centroid.velocity)
}
}
TapHandler { gesturePolicy: TapHandler.DragThreshold; onTapped: rect3.z = rect2.z + 1 }
@@ -164,8 +164,8 @@ Rectangle {
Rectangle {
id: centroidIndicator
property QtObject pincher: activePincher()
- x: pincher.centroid.x - radius
- y: pincher.centroid.y - radius
+ x: pincher.centroid.scenePosition.x - radius
+ y: pincher.centroid.scenePosition.y - radius
z: 1
visible: pincher.active
radius: width / 2