MapGestureArea
The MapGestureArea type provides Map gesture interaction. More...
Import Statement: | import QtLocation 5.0 |
Since: | Qt Location 5.0 |
Properties
- activeGestures : enumeration
- enabled : bool
- flickDeceleration : real
- isPanActive : bool
- isPinchActive : bool
- maximumZoomLevelChange : real
- panEnabled : bool
- pinchEnabled : bool
- rotationFactor : real
Signals
- flickFinished()
- flickStarted()
- panFinished()
- panStarted()
- pinchFinished(PinchEvent event)
- pinchStarted(PinchEvent event)
- pinchUpdated(PinchEvent event)
Detailed Description
MapGestureArea objects are used as part of a Map, to provide for panning, flicking and pinch-to-zoom gesture used on touch displays.
A MapGestureArea is automatically created with a new Map and available with the gesture property. This is the only way to create a MapGestureArea, and once created this way cannot be destroyed without its parent Map.
The two most commonly used properties of the MapGestureArea are the enabled and activeGestures properties. Both of these must be set before a MapGestureArea will have any effect upon interaction with the Map. The flickDeceleration property controls how quickly the map pan slows after contact is released while panning the map.
Performance
The MapGestureArea, when enabled, must process all incoming touch events in order to track the shape and size of the "pinch". The overhead added on touch events can be considered constant time.
Example Usage
The following example enables the zoom and pan gestures on the map, but not flicking. So the map scrolling will halt immediately on releasing the mouse button / touch.
Map { gesture.enabled: true gesture.activeGestures: MapGestureArea.ZoomGesture | MapGestureArea.PanGesture }
Property Documentation
This property holds the gestures that will be active. By default the zoom, pan and flick gestures are enabled.
- MapGestureArea.NoGesture - Don't support any additional gestures (value: 0x0000).
- MapGestureArea.ZoomGesture - Support the map zoom gesture (value: 0x0001).
- MapGestureArea.RotationGesture - Support the map rotation gesture (value: 0x0002).
- MapGestureArea.TiltGesture - Support the map tilt gesture (value: 0x0004).
- MapGestureArea.PanGesture - Support the map pan gesture (value: 0x0008).
- MapGestureArea.FlickGesture - Support the map flick gesture (value: 0x0010).
For the extremist, one may OR flag the RotationGesture or TiltGesture but these come with absolutely no warranty or guarantees at the moment (may be removed, changed, moved around)
Note: For the time being, only MapGestureArea.ZoomGesture is supported.
This property holds whether the gestures are enabled. Note: disabling gestures during an active gesture does not have effect on the potentially active current gesture.
This property holds the rate at which a flick will decelerate.
The default value is 2500.
This read-only property holds whether any pan gesture (panning or flicking) is active.
This property holds the maximum zoom level change per pinch, essentially meant to be used for setting the zoom sensitivity.
It is an indicative measure calculated from the dimensions of the map area, roughly corresponding how much zoom level could change with maximum pinch zoom. Default value is 2.0, maximum value is 10.0
This property holds whether the pan gestures are enabled. Note: disabling gestures during an active gesture does not have effect on the potentially active current gesture.
This property holds whether the pinch gestures are enabled. Note: disabling gestures during an active gesture does not have effect on the potentially active current gesture.
This property holds the rotation factor for zoom, essentially meant to be used for setting the rotation sensitivity.
It is an indicative measure; the default value 1.0 means the map roughly follows the fingers, whereas 2.0 means rotating twice as fast. Maximum value is 5.0.
Signal Documentation
This handler is called when the view stops moving due to a flick. The order of panFinished() and flickFinished() is not specified.
This handler is called when the view is flicked. A flick starts from the point that the mouse or touch is released, while still in motion.
This handler is called when the view stops moving due to user interaction. If a flick was generated, this handler will be triggered once the flick stops. If a flick was not generated, the handler will be triggered when the user stops dragging - that is a mouse or touch release.
This handler is called when the view begins moving due to user interaction. Typically this means that the user is dragging a finger - or a mouse with one of more mouse buttons pressed - on the map.
The end of a pinch gesture is signaled by this event.
See also pinchStarted and pinchUpdated.
Raised when a pinch gesture is started.
See also pinchUpdated and pinchFinished.
Once a pinch has begun this event gets raised as the user moves her fingers across the map.
See also pinchStarted and pinchFinished.