PointerDevice QML Type

相当于QPointingDevice 的 QML。更多

Import Statement: import QtQuick
In C++: QPointingDevice

属性

信号

  • 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::DeviceTypePointerDeviceHandler::acceptedDevices


maximumPoints : int

该属性显示可检测到的最大同时触控点(手指)数量。


pointerType : enumeration

该属性显示与PointerDevice 交互的内容。

该属性与deviceType 之间存在一些冗余。例如,如果使用触摸屏,那么deviceType 就是TouchScreenpointerType 就是FingerPointerDeviceHandler::acceptedDevicesPointerDeviceHandler::acceptedPointerTypes 可结合使用,以过滤特定处理程序应作出反应的事件子集。

有效值为

常量说明
PointerDevice.Unknown无法识别设备。
PointerDevice.Generic鼠标或模拟鼠标的设备。
PointerDevice.Finger触摸屏上的手指。
PointerDevice.Pen绘图板上的触控笔。
PointerDevice.Eraser绘图板上的橡皮擦。
PointerDevice.Cursor绘图板上带十字准线的数字转换器。

另请参阅 QPointingDevice::PointerTypePointerDeviceHandler::acceptedPointerTypes


该属性可提供设备的唯一 ID(如有)。例如,绘图板触控笔设备可能有一个唯一的序列号。

另请参阅 eventPointQEventPoint::uniqueId() 。


信号文档

grabChanged(QtObject grabber, enumeration transition, PointerEvent event, eventPoint point)

grabber 对象在event 的传送过程中获得或失去对point 的独占或被动抓取时,就会发出该信号。transition 会从grabber 对象(可以是Item输入处理程序)的角度说明发生了什么。

transition 的有效值为

常量说明
PointerDevice.GrabExclusivegrabber 承担了处理point 的主要责任。
PointerDevice.UngrabExclusivegrabber 已放弃之前的独家抓取。
PointerDevice.CancelGrabExclusivegrabber 的独家抓取已被接管或取消。
PointerDevice.GrabPassivegrabber 已获得被动抓取,以监控point
PointerDevice.UngrabPassivegrabber 已放弃之前的被动抓取。
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.