QPointingDevice 类描述发源鼠标、触摸或数位板事件的设备。 更多...
头: | #include <QPointingDevice> |
CMake: |
find_package(Qt6 COMPONENTS Gui REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
Since: | Qt 6.0 |
继承: | QInputDevice |
enum class | PointerType { Unknown, Generic, Finger, Pen, Eraser, …, AllPointerTypes } |
flags | PointerTypes |
QPointingDevice (const QString & name , qint64 id , QInputDevice::DeviceType deviceType , QPointingDevice::PointerType pointerType , QInputDevice::Capabilities capabilities , int maxPoints , int buttonCount , const QString & seatName = QString(), QPointingDeviceUniqueId uniqueId = QPointingDeviceUniqueId(), QObject * parent = nullptr) | |
QPointingDevice (QObject * parent = nullptr) | |
int | buttonCount () const |
int | maximumPoints () const |
QPointingDevice::PointerType | pointerType () const |
QPointingDeviceUniqueId | uniqueId () const |
const QPointingDevice * | primaryPointingDevice (const QString & seatName = QString()) |
每个 QPointerEvent contains a QPointingDevice pointer to allow accessing device-specific properties like type and capabilities. It is the responsibility of the platform or generic plug-ins to register the available pointing devices via QWindowSystemInterface before generating any pointer events. Applications do not need to instantiate this class, they should just access the global instances pointed to by QPointerEvent::device ().
This enum represents what is interacting with the pointing device.
There is some redundancy between this property and
QInputDevice::DeviceType
. For example, if a touchscreen is used, then the
DeviceType
is
TouchScreen
and
PointerType
is
Finger
(always). But on a graphics tablet, it's often possible for both ends of the stylus to be used, and programs need to distinguish them. Therefore the concept is extended so that every
QPointerEvent
has a PointerType, and it can simplify some event handling code to ignore the DeviceType and react differently depending on the PointerType alone.
Valid values are:
常量 | 值 | 描述 |
---|---|---|
QPointingDevice::PointerType::Unknown
|
0
|
指针类型未知。 |
QPointingDevice::PointerType::Generic
|
0x0001
|
A mouse or something acting like a mouse (the core pointer on X11). |
QPointingDevice::PointerType::Finger
|
0x0002
|
用户的手指。 |
QPointingDevice::PointerType::Pen
|
0x0004
|
The drawing end of a stylus. |
QPointingDevice::PointerType::Eraser
|
0x0008
|
The other end of the stylus (if it has a virtual eraser on the other end). |
QPointingDevice::PointerType::Cursor
|
0x0010
|
A transparent circle with cross-hairs as found on a Puck 设备。 |
QPointingDevice::PointerType::AllPointerTypes
|
0x7FFF
|
Any of the above (used as a default filter value). |
The PointerTypes type is a typedef for QFlags <PointerType>. It stores an OR combination of PointerType values.
创建新的指向设备实例采用给定 name , deviceType , pointerType , capabilities , maxPoints , buttonCount , seatName , uniqueId and parent .
Creates a new invalid pointing device instance as a child of parent .
Returns the maximum number of on-device buttons that can be detected.
注意: Getter 函数对于特性 buttonCount。
Returns the maximum number of simultaneous touch points (fingers) that can be detected.
注意: Getter function for property maximumPoints.
返回指针类型。
注意: Getter 函数对于特性 pointerType。
[static]
const
QPointingDevice
*QPointingDevice::
primaryPointingDevice
(const
QString
&
seatName
= QString())
返回首要指向设备 (核心指针,传统假定为鼠标) 按给定座位 seatName .
If multiple pointing devices are registered, this function prefers a mouse or touchpad that matches the given seatName and that does not have another device as its parent. Usually only one master or core device does not have a parent device. But if such a device is not found, this function creates a new virtual "core pointer" mouse. Thus Qt continues to work on platforms that are not yet doing input device discovery and registration.
Returns a unique ID (of dubious utility) for the device.
You probably should rather be concerned with QPointerEventPoint::uniqueId().
注意: Getter function for property uniqueId.