QPointingDevice Class▲
-
Header: QPointingDevice
-
Since: Qt 6.0
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
-
qmake: QT += gui
-
Inherits: QInputDevice
-
Group: QPointingDevice is part of events
Detailed Description▲
Each 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().
Member Type Documentation▲
enum QPointingDevice::PointerType▲
flags QPointingDevice::PointerTypes
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:
Constant |
Value |
Description |
---|---|---|
QPointingDevice::PointerType::Unknown |
0 |
The pointer type is unknown. |
QPointingDevice::PointerType::Generic |
0x0001 |
A mouse or something acting like a mouse (the core pointer on X11). |
QPointingDevice::PointerType::Finger |
0x0002 |
The user's finger. |
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 device. |
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.
Member Function Documentation▲
QPointingDevice::QPointingDevice(QObject *parent = nullptr)▲
Creates a new invalid pointing device instance as a child of parent.
QPointingDevice::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)▲
Creates a new pointing device instance with the given name, deviceType, pointerType, capabilities, maxPoints, buttonCount, seatName, uniqueId and parent.
int QPointingDevice::buttonCount() const▲
Getter function for property buttonCount.
int QPointingDevice::maximumPoints() const▲
Returns the maximum number of simultaneous touch points (fingers) that can be detected.
Getter function for property maximumPoints.
QPointingDevice::PointerType QPointingDevice::pointerType() const▲
Returns the pointer type.
Getter function for property pointerType.
[static] const QPointingDevice *QPointingDevice::primaryPointingDevice(const QString &seatName = QString())▲
Returns the primary pointing device (the core pointer, traditionally assumed to be a mouse) on the given seat 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.
QPointingDeviceUniqueId QPointingDevice::uniqueId() const▲
Returns a unique ID (of dubious utility) for the device.
You probably should rather be concerned with QPointerEventPoint::uniqueId().
Getter function for property uniqueId.