The MapGestureArea type provides Map gesture interaction. 更多...
import 语句: | import QtLocation 5.15 |
Since: | QtLocation 5.0 |
MapGestureArea objects are used as part of a Map, to provide for panning, flicking and pinch-to-zoom gesture used on touch displays, as well as two finger rotation and two finger parallel vertical sliding to tilt the map. On platforms supporting QWheelEvent , using the scroll wheel alone, or in combination with key modifiers Shift or Control will also zoom, rotate or tilt the map, respectively.
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 acceptedGestures 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.
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.
The following example enables the pinch 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.acceptedGestures: MapGestureArea.PinchGesture | MapGestureArea.PanGesture }
acceptedGestures : enumeration |
This property holds a bit field of gestures that are accepted. By default, all gestures are enabled.
常量 | 描述 |
---|---|
MapGestureArea.NoGesture
|
Don't support any additional gestures (value: 0x0000). |
MapGestureArea.PinchGesture
|
Support the map pinch gesture (value: 0x0001). |
MapGestureArea.PanGesture
|
Support the map pan gesture (value: 0x0002). |
MapGestureArea.FlickGesture
|
Support the map flick gesture (value: 0x0004). |
MapGestureArea.RotationGesture
|
Support the map rotation gesture (value: 0x0008). |
MapGestureArea.TiltGesture
|
Support the map tilt gesture (value: 0x0010). |
enabled : bool |
This property holds whether the gestures are enabled.
flickDeceleration : real |
This property holds the rate at which a flick will decelerate.
The default value is 2500.
maximumZoomLevelChange : real |
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 4.0, maximum value is 10.0
panActive : bool |
This read-only property holds whether the pan gesture is active.
注意: Change notifications for this property were introduced in Qt 5.5.
pinchActive : bool |
This read-only property holds whether the pinch gesture is active.
preventStealing : bool |
This property holds whether the mouse events may be stolen from this MapGestureArea .
If a Map is placed within an item that filters child mouse and touch events, such as Flickable, the mouse and touch events may be stolen from the
MapGestureArea
if a gesture is recognized by the parent item, e.g. a flick gesture. If preventStealing is set to
true
, no item will steal the mouse and touch events.
Note that setting preventStealing to
true
once an item has started stealing events has no effect until the next press event.
By default this property is set to
false
.
rotationActive : bool |
This read-only property holds whether the two-finger rotation gesture is active.
This property was introduced in QtLocation 5.9.
tiltActive : bool |
This read-only property holds whether the two-finger tilt gesture is active.
This property was introduced in QtLocation 5.9.
This signal is emitted when the map stops moving due to a flick.
相应处理程序是
onFlickFinished
.
注意:
相应处理程序是
onFlickFinished
.
This signal is emitted when the map is flicked. A flick starts from the point where the mouse or touch was released, while still in motion.
相应处理程序是
onFlickStarted
.
注意:
相应处理程序是
onFlickStarted
.
This signal is emitted when the map stops moving due to user interaction. If a flick was generated, this signal is emitted before flick starts. If a flick was not generated, this signal is emitted when the user stops dragging - that is a mouse or touch release.
相应处理程序是
onPanFinished
.
注意:
相应处理程序是
onPanFinished
.
This signal is emitted when the map begins to move 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.
相应处理程序是
onPanStarted
.
注意:
相应处理程序是
onPanStarted
.
pinchFinished ( PinchEvent event ) |
This signal is emitted at the end of a pinch gesture.
Information about the pinch event is provided in event .
相应处理程序是
onPinchFinished
.
注意:
相应处理程序是
onPinchFinished
.
另请参阅 pinchStarted and pinchUpdated .
pinchStarted ( PinchEvent event ) |
This signal is emitted when a pinch gesture is started.
Information about the pinch event is provided in event .
相应处理程序是
onPinchStarted
.
注意:
相应处理程序是
onPinchStarted
.
另请参阅 pinchUpdated and pinchFinished .
pinchUpdated ( PinchEvent event ) |
This signal is emitted as the user's fingers move across the map, after the pinchStarted 信号发射。
Information about the pinch event is provided in event .
相应处理程序是
onPinchUpdated
.
注意:
相应处理程序是
onPinchUpdated
.
另请参阅 pinchStarted and pinchFinished .
rotationFinished ( PinchEvent event ) |
This signal is emitted at the end of a two-finger rotation gesture.
Information about the pinch event is provided in event .
相应处理程序是
onRotationFinished
.
注意:
相应处理程序是
onRotationFinished
.
This signal was introduced in QtLocation 5.9.
另请参阅 rotationStarted() and rotationUpdated() .
rotationStarted ( PinchEvent event ) |
This signal is emitted when a two-finger rotation gesture is started.
Information about the pinch event is provided in event .
相应处理程序是
onRotationStarted
.
注意:
相应处理程序是
onRotationStarted
.
This signal was introduced in QtLocation 5.9.
另请参阅 rotationUpdated() and rotationFinished() .
rotationUpdated ( PinchEvent event ) |
This signal is emitted as the user's fingers move across the map, after the rotationStarted() 信号发射。
Information about the pinch event is provided in event .
相应处理程序是
onRotationUpdated
.
注意:
相应处理程序是
onRotationUpdated
.
This signal was introduced in QtLocation 5.9.
另请参阅 rotationStarted() and rotationFinished() .
tiltFinished ( PinchEvent event ) |
This signal is emitted at the end of a two-finger tilt gesture.
Information about the pinch event is provided in event .
相应处理程序是
onTiltFinished
.
注意:
相应处理程序是
onTiltFinished
.
This signal was introduced in QtLocation 5.9.
另请参阅 tiltStarted() and tiltUpdated() .
tiltStarted ( PinchEvent event ) |
This signal is emitted when a two-finger tilt gesture is started.
Information about the pinch event is provided in event .
相应处理程序是
onTiltStarted
.
注意:
相应处理程序是
onTiltStarted
.
This signal was introduced in QtLocation 5.9.
另请参阅 tiltUpdated() and tiltFinished() .
tiltUpdated ( PinchEvent event ) |
This signal is emitted as the user's fingers move across the map, after the tiltStarted 信号发射。
Information about the pinch event is provided in event .
相应处理程序是
onTiltUpdated
.
注意:
相应处理程序是
onTiltUpdated
.
This signal was introduced in QtLocation 5.9.
另请参阅 tiltStarted() and tiltFinished() .