PinchArea QML 类型

启用简单捏合手势处理 更多...

import 语句: import QtQuick 2.7
继承: Item

特性

信号

详细描述

The PinchArea 类型的添加是在 QtQuick 1.1

A PinchArea is an invisible item that is typically used in conjunction with a visible item in order to provide pinch gesture handling for that item.

The enabled property is used to enable and disable pinch handling for the proxied item. When disabled, the pinch area becomes transparent to mouse/touch events.

PinchArea 可以按 2 种方式使用:

  • 设置 pinch.target to provide automatic interaction with an item
  • using the onPinchStarted, onPinchUpdated and onPinchFinished handlers

从 Qt 5.5 起, PinchArea can react to native pinch gesture events from the operating system if available; otherwise it reacts only to touch events.

另请参阅 PinchEvent , QNativeGestureEvent ,和 QTouchEvent .

特性文档编制

enabled : bool

This property holds whether the item accepts pinch gestures.

This property defaults to true.

pinch group

pinch.target : Item

pinch.active : bool

pinch.minimumScale : real

pinch.maximumScale : real

pinch.minimumRotation : real

pinch.maximumRotation : real

pinch.dragAxis : enumeration

pinch.minimumX : real

pinch.maximumX : real

pinch.minimumY : real

pinch.maximumY : real

pinch provides a convenient way to make an item react to pinch gestures.

  • pinch.target specifies the id of the item to drag.
  • pinch.active specifies if the target item is currently being dragged.
  • pinch.minimumScale and pinch.maximumScale limit the range of the Item.scale property, but not the PinchEvent scale 特性。
  • pinch.minimumRotation and pinch.maximumRotation limit the range of the Item.rotation property, but not the PinchEvent rotation 特性。
  • pinch.dragAxis specifies whether dragging in not allowed ( Pinch.NoDrag ), can be done horizontally ( Pinch.XAxis ), vertically ( Pinch.YAxis ), or both ( Pinch.XAndYAxis )
  • pinch.minimum and pinch.maximum limit how far the target can be dragged along the corresponding axes.

信号文档编制

pinchFinished ()

This signal is emitted when the pinch area detects that a pinch gesture has finished.

The pinch parameter (not the same as the pinch property) provides information about the pinch gesture, including the scale, center and angle of the pinch.

相应处理程序是 onPinchFinished .

pinchStarted ()

This signal is emitted when the pinch area detects that a pinch gesture has started: two touch points (fingers) have been detected, and they have moved beyond the startDragDistance threshold for the gesture to begin.

The pinch parameter (not the same as the pinch property) provides information about the pinch gesture, including the scale, center and angle of the pinch. At the time of the pinchStarted signal, these values are reset to the default values, regardless of the results from previous gestures: pinch.scale will be 1.0 and pinch.rotation will be 0.0 . As the gesture progresses, pinchUpdated will report the deviation from those defaults.

要忽略此手势设置 pinch.accepted property to false. The gesture will be canceled and no further events will be sent.

相应处理程序是 onPinchStarted .

pinchUpdated ()

This signal is emitted when the pinch area detects that a pinch gesture has changed.

The pinch parameter provides information about the pinch gesture, including the scale, center and angle of the pinch. These values reflect changes only since the beginning of the current gesture, and therefore are not limited by the minimum and maximum limits in the pinch 特性。

相应处理程序是 onPinchUpdated .

smartZoom ()

This signal is emitted when the pinch area detects the smart zoom gesture. This gesture occurs only on certain operating systems such as macOS.

The pinch parameter provides information about the pinch gesture, including the location where the gesture occurred. pinch.scale will be greater than zero when the gesture indicates that the user wishes to enter smart zoom, and zero when exiting (even though typically the same gesture is used to toggle between the two states).

相应处理程序是 onSmartZoom .

该 QML 信号在 Qt 5.5 引入。