The GestureArea item enables simple gesture handling. More...
Inherits Item
A GestureArea is like a MouseArea, but it has signals for gesture events.
Elements in the Qt.labs module are not guaranteed to remain compatible in future versions.
This element is only functional on devices with touch input.
import Qt.labs.gestures 0.1 GestureArea { anchors.fill: parent onPan: ... gesture.acceleration ... onPinch: ... gesture.rotationAngle ... onSwipe: ... onTapAndHold: ... onTap: ... onGesture: ... }
Each signal has a gesture parameter that has the properties of the gesture.
Signal | Type | Property | Description |
---|---|---|---|
onTap | point | position | the position of the tap |
onTapAndHold | point | position | the position of the tap |
onPan | real | acceleration | the acceleration of the pan |
onPan | point | delta | the offset from the previous input position to the current input |
onPan | point | offset | the total offset from the first input position to the current input position |
onPan | point | lastOffset | the previous value of offset |
onPinch | point | centerPoint | the midpoint between the two input points |
onPinch | point | lastCenterPoint | the previous value of centerPoint |
onPinch | point | startCenterPoint | the first value of centerPoint |
onPinch | real | rotationAngle | the angle covered by the gesture motion |
onPinch | real | lastRotationAngle | the previous value of rotationAngle |
onPinch | real | totalRotationAngle | the complete angle covered by the gesture |
onPinch | real | scaleFactor | the change in distance between the two input points |
onPinch | real | lastScaleFactor | the previous value of scaleFactor |
onPinch | real | totalScaleFactor | the complete scale factor of the gesture |
onSwipe | real | swipeAngle | the angle of the swipe |
Custom gestures, handled by onGesture, will have custom properties.
GestureArea is an invisible item: it is never painted.
See also MouseArea and Gestures example.