本页内容

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 [read-only]

此属性指定了可检测到的设备上按钮的最大数量。

deviceType : enumeration

该属性用于标识生成PointerEvent 的设备类型。

有效值为:

常量描述
PointerDevice.Unknown无法识别该设备。
PointerDevice.Mouse鼠标。
PointerDevice.TouchScreen触摸屏。
PointerDevice.TouchPad触控板或触控板。
PointerDevice.Stylus绘图板上的触控笔。
PointerDevice.Airbrush绘图板上的喷笔。
PointerDevice.Puck绘图板上带十字准线的数字化仪。

另请参阅 QInputDevice::DeviceType 和PointerDeviceHandler::acceptedDevices 。

maximumPoints : int [read-only]

此属性指定了可检测到的最大同时触点(手指)数量。

pointerType : enumeration [read-only]

该属性用于说明与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 [read-only]

如果可用,该属性可能会为设备提供一个唯一标识符。例如,绘图板触控笔设备可能有一个唯一的序列号。

另请参阅 eventPoint 和QEventPoint::uniqueId()。

Signal 文档

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

当grabber 对象在传输event 时,获得或失去对point 的独占或被动抓取时,会发出此信号。transition 从grabber 对象的角度描述了发生的情况,该对象可以是Item ,也可以是Input Handler。

transition 的有效取值包括:

常量描述
PointerDevice.GrabExclusivegrabber 已承担起处理point 的主要责任。
PointerDevice.UngrabExclusivegrabber 已放弃其先前的独占控制权。
PointerDevice.CancelGrabExclusivegrabber 的独占抓取已被接管或取消。
PointerDevice.GrabPassivegrabber 已获得被动抓取,用于监控point 。
PointerDevice.UngrabPassivegrabber 已放弃其先前的被动抓取。
PointerDevice.CancelGrabPassive之前的被动抓取已异常终止。

注意: 从一个对象切换到另一个对象的抓取操作 会触发两个信号,一个用于通知某个对象已失去抓取,另一个用于通知存在另一个抓取者。在其他情况下,当切换至或离开非抓取状态时,仅会发出一个信号。

注: 相应的处理程序 是onGrabChanged 。

另请参阅 QPointerEvent::setExclusiveGrabber()、QPointerEvent::addPassiveGrabber()、QPointerEvent::removePassiveGrabber() 以及PointerHandler::grabChanged()。

© 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.