PinchArea QML Type
支持简单的捏合手势处理。更多...
| Import Statement: | import QtQuick |
| Inherits: |
属性
- enabled : bool
- pinch
- pinch.active : bool
- pinch.dragAxis : enumeration
- pinch.maximumRotation : real
- pinch.maximumScale : real
- pinch.maximumX : real
- pinch.maximumY : real
- pinch.minimumRotation : real
- pinch.minimumScale : real
- pinch.minimumX : real
- pinch.minimumY : real
- pinch.target : Item
信号
- pinchFinished(PinchEvent pinch)
- pinchStarted(PinchEvent pinch)
- pinchUpdated(PinchEvent pinch)
- smartZoom(PinchEvent pinch)
详细说明
PinchArea 是一个不可见的控件,通常与可见控件配合使用,以便为该控件提供捏合手势处理功能。
enabled 属性用于启用或禁用被代理项的捏合手势处理。禁用时,捏合区域对鼠标/触摸事件将变为透明。
PinchArea 有两种使用方式:
- 设置 `
pinch.target` 以实现与控件的自动交互 - 使用 onPinchStarted、onPinchUpdated 和 onPinchFinished 处理程序
自 Qt 5.5 起,如果操作系统支持原生捏合手势事件,PinchArea 可以对此作出响应;否则,它仅对触摸事件作出响应。
另请参阅 PinchEvent 、QNativeGestureEvent 和QTouchEvent 。
属性文档
enabled : bool
该属性用于指定该项目是否支持捏合手势。
该属性的默认值为 true。
pinch group
pinch.active : bool [read-only]
pinch.dragAxis : enumeration
pinch.maximumRotation : real
pinch.maximumScale : real
pinch.maximumX : real
pinch.maximumY : real
pinch.minimumRotation : real
pinch.minimumScale : real
pinch.minimumX : real
pinch.minimumY : real
pinch.target : Item
pinch 提供了一种便捷的方式,使项目能够响应捏合手势。
pinch.target指定要拖动的项目的 ID。pinch.active指定目标项目当前是否正在被拖动。pinch.minimumScalepinch.maximumScale会限制 Item.scale 属性的范围,但不会限制 以及 属性的范围。PinchEventscalepinch.minimumRotationpinch.maximumRotation限制了 Item.scale 属性的取值范围,但不限制 属性的取值范围。PinchEventrotationpinch.dragAxis指定是否不允许拖动(Pinch.NoDrag)、仅允许水平拖动(Pinch.XAxis)、仅允许垂直拖动(Pinch.YAxis)或允许两者(Pinch.XAndYAxis)pinch.minimum其中pinch.maximum用于限制目标沿相应轴向可被拖动的最大距离。
Signal 文档
pinchFinished(PinchEvent pinch)
当捏合区域检测到捏合手势结束时,会发出此信号。
pinch 参数(与pinch 属性不同)提供了有关捏合手势的信息,包括缩放比例、中心点和捏合角度。
注意: 相应的处理程序 是onPinchFinished 。
pinchStarted(PinchEvent pinch)
当捏合区域检测到捏合手势开始时,会发出此信号:已检测到两个触点(手指),且它们的移动距离已超过startDragDistance 中该手势开始的阈值。
pinch 参数(与pinch 属性不同)提供有关捏合手势的信息,包括缩放比例、中心点和捏合角度。 在触发pinchStarted 信号时,无论先前手势的结果如何,这些值都会重置为默认值:pinch.scale将设为1.0 ,pinch.rotation将设为0.0 。随着手势的进行,pinchUpdated 将报告其与这些默认值的偏差。
若要忽略此手势,请将pinch.accepted 属性设置为 false。该手势将被取消,且不会发送任何后续事件。
注意: 相应的处理程序 是onPinchStarted 。
pinchUpdated(PinchEvent pinch)
当捏合区域检测到捏合手势发生变化时,会发出此信号。
pinch 参数提供了有关捏合手势的信息,包括捏合的缩放比例、中心点和角度。这些值仅反映自当前手势开始以来的变化,因此不受pinch 属性中设置的最小值和最大值的限制。
注意: 相应的处理程序 是onPinchUpdated 。
smartZoom(PinchEvent pinch)
当捏合区域检测到智能缩放手势时,会发出此信号。该手势仅在某些操作系统(如 macOS)上出现。
pinch 参数提供了有关捏合手势的信息,包括手势发生的位置。当手势表明用户希望进入智能缩放模式时,pinch.scale 将大于零;退出时则为零(尽管通常使用相同的手势在两种状态之间切换)。
注意: 对应的处理程序 是onSmartZoom 。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.