MultiPointTouchArea
Enables handling of multiple touch points More...
Import Statement: | import QtQuick 2.2 |
Inherits: |
Properties
- maximumTouchPoints : int
- minimumTouchPoints : int
- touchPoints : list<TouchPoint>
Signals
- onCanceled(list<TouchPoint> touchPoints)
- onGestureStarted(GestureEvent gesture)
- onPressed(list<TouchPoint> touchPoints)
- onReleased(list<TouchPoint> touchPoints)
- onTouchUpdated(list<TouchPoint> touchPoints)
- onUpdated(list<TouchPoint> touchPoints)
Detailed Description
A MultiPointTouchArea is an invisible item that is used to track multiple touch points.
The Item::enabled property is used to enable and disable touch handling. When disabled, the touch area becomes transparent to mouse/touch events.
MultiPointTouchArea can be used in two ways:
- setting touchPoints to provide touch point objects with properties that can be bound to
- using the onTouchUpdated or onPressed, onUpdated and onReleased handlers
While a MultiPointTouchArea can take exclusive ownership of certain touch points, it is also possible to have multiple MultiPointTouchAreas active at the same time, each operating on a different set of touch points.
See also TouchPoint.
Property Documentation
These properties hold the range of touch points to be handled by the touch area.
These are convenience that allow you to, for example, have nested MultiPointTouchAreas, one handling two finger touches, and another handling three finger touches.
By default, all touch points within the touch area are handled.
These properties hold the range of touch points to be handled by the touch area.
These are convenience that allow you to, for example, have nested MultiPointTouchAreas, one handling two finger touches, and another handling three finger touches.
By default, all touch points within the touch area are handled.
touchPoints : list<TouchPoint> |
This property holds a set of user-defined touch point objects that can be bound to.
In the following example, we have two small rectangles that follow our touch points.
import QtQuick 2.0 Rectangle { width: 400; height: 400 MultiPointTouchArea { anchors.fill: parent touchPoints: [ TouchPoint { id: point1 }, TouchPoint { id: point2 } ] } Rectangle { width: 30; height: 30 color: "green" x: point1.x y: point1.y } Rectangle { width: 30; height: 30 color: "yellow" x: point2.x y: point2.y } }
By default this property holds an empty list.
See also TouchPoint.
Signal Documentation
onCanceled(list<TouchPoint> touchPoints) |
This handler is called when new touch events have been canceled because another item stole the touch event handling.
This signal is for advanced use: it is useful when there is more than one MultiPointTouchArea that is handling input, or when there is a MultiPointTouchArea inside a Flickable. In the latter case, if you execute some logic on the onPressed signal and then start dragging, the Flickable may steal the touch handling from the MultiPointTouchArea. In these cases, to reset the logic when the MultiPointTouchArea has lost the touch handling to the Flickable, onCanceled should be used in addition to onReleased.
touchPoints is the list of canceled points.
This handler is called when the global drag threshold has been reached.
This function is typically used when a MultiPointTouchAreas has been nested in a Flickable or another MultiPointTouchArea. When the threshold has been reached, and the handler called, you can determine whether or not the touch area should grab the current touch points. By default they will not be grabbed; to grab them call gesture.grab(). If the gesture is not grabbed, the nesting Flickable, for example, would also have an opportunity to grab.
The gesture object also includes information on the current set of touchPoints and the dragThreshold.
onPressed(list<TouchPoint> touchPoints) |
This handler is called when new touch points are added. touchPoints is a list of these new points.
If minimumTouchPoints is set to a value greater than one, this handler will not be called until the minimum number of required touch points has been reached. At that point, onPressed will be called with all the current touch points.
onReleased(list<TouchPoint> touchPoints) |
This handler is called when existing touch points are removed. touchPoints is a list of these removed points.
onTouchUpdated(list<TouchPoint> touchPoints) |
This handler is called when the touch points handled by the MultiPointTouchArea change. This includes adding new touch points, removing or canceling previous touch points, as well as updating current touch point data. touchPoints is the list of all current touch points.
onUpdated(list<TouchPoint> touchPoints) |
This handler is called when existing touch points are updated. touchPoints is a list of these updated points.