PointerDevice QML Type
相当于QPointingDevice 的 QML。更多
Import Statement: | import QtQuick |
In C++: | QPointingDevice |
属性
- buttonCount : int
- deviceType : enumeration
- maximumPoints : int
- pointerType : enumeration
- uniqueId : pointingDeviceUniqueId
信号
- grabChanged(QtObject grabber, enumeration transition, PointerEvent event, eventPoint point)
详细说明
PointerDevice 是QPointingDevice 类的 QML 名称。它具有与QPointingDevice 相同的属性和枚举。
属性文档
buttonCount : int |
该属性显示可检测到的设备上按钮的最大数量。
deviceType : enumeration |
该属性显示生成PointerEvent 的设备类型。
有效值为
常量 | 说明 |
---|---|
PointerDevice.Unknown | 无法识别设备。 |
PointerDevice.Mouse | 鼠标。 |
PointerDevice.TouchScreen | 触摸屏。 |
PointerDevice.TouchPad | 触摸板或触控板。 |
PointerDevice.Stylus | 绘图板上的触控笔。 |
PointerDevice.Airbrush | 绘图板上的喷笔。 |
PointerDevice.Puck | 绘图板上带有十字准线的数字转换器。 |
另请参阅 QInputDevice::DeviceType 和PointerDeviceHandler::acceptedDevices 。
maximumPoints : int |
该属性显示可检测到的最大同时触控点(手指)数量。
pointerType : enumeration |
该属性显示与PointerDevice 交互的内容。
该属性与deviceType 之间存在一些冗余。例如,如果使用触摸屏,那么deviceType
就是TouchScreen
,pointerType
就是Finger
。PointerDeviceHandler::acceptedDevices 和PointerDeviceHandler::acceptedPointerTypes 可结合使用,以过滤特定处理程序应作出反应的事件子集。
有效值为
常量 | 说明 |
---|---|
PointerDevice.Unknown | 无法识别设备。 |
PointerDevice.Generic | 鼠标或模拟鼠标的设备。 |
PointerDevice.Finger | 触摸屏上的手指。 |
PointerDevice.Pen | 绘图板上的触控笔。 |
PointerDevice.Eraser | 绘图板上的橡皮擦。 |
PointerDevice.Cursor | 绘图板上带十字准线的数字转换器。 |
另请参阅 QPointingDevice::PointerType 和PointerDeviceHandler::acceptedPointerTypes 。
uniqueId : pointingDeviceUniqueId |
该属性可提供设备的唯一 ID(如有)。例如,绘图板触控笔设备可能有一个唯一的序列号。
另请参阅 eventPoint 和QEventPoint::uniqueId() 。
信号文档
grabChanged(QtObject grabber, enumeration transition, PointerEvent event, eventPoint point) |
当grabber 对象在event 的传送过程中获得或失去对point 的独占或被动抓取时,就会发出该信号。transition 会从grabber
对象(可以是Item 或输入处理程序)的角度说明发生了什么。
transition 的有效值为
常量 | 说明 |
---|---|
PointerDevice.GrabExclusive | grabber 承担了处理point 的主要责任。 |
PointerDevice.UngrabExclusive | grabber 已放弃之前的独家抓取。 |
PointerDevice.CancelGrabExclusive | grabber 的独家抓取已被接管或取消。 |
PointerDevice.GrabPassive | grabber 已获得被动抓取,以监控point 。 |
PointerDevice.UngrabPassive | grabber 已放弃之前的被动抓取。 |
PointerDevice.CancelGrabPassive | 之前的被动抓取异常终止。 |
注意: 从一个对象到另一个对象的抓取过渡会产生两个信号,一个是通知一个对象已失去抓取,另一个是通知有另一个抓取器。在其他情况下,过渡到非抓取状态或从非抓取状态过渡时,只发出一个信号。
注: 相应的处理程序是onGrabChanged
。
另请参阅 QPointerEvent::setExclusiveGrabber()、QPointerEvent::addPassiveGrabber()、QPointerEvent::removePassiveGrabber() 和PointerHandler::grabChanged()。
© 2025 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.