QInputDevice¶
The QInputDevice
class describes a device from which a QInputEvent
originates. More…
Inherited by: QPointingDevice
Synopsis¶
Functions¶
def
__eq__
(other)def
availableVirtualGeometry
()def
capabilities
()def
hasCapability
(cap)def
name
()def
seatName
()def
systemId
()def
type
()
Signals¶
def
availableVirtualGeometryChanged
(area)
Static functions¶
def
devices
()def
primaryKeyboard
([seatName=””])
Detailed Description¶
Each QInputEvent
contains a QInputDevice
pointer to allow accessing device-specific properties like type, capabilities and seat. It is the responsibility of the platform or generic plug-ins to discover, create and register an instance of this class corresponding to each available input device, via , before generating any input event referring to that device.
Applications do not need to instantiate this class, but can read the instances pointed to by device()
and devices()
.
- class PySide6.QtGui.QInputDevice([parent=None])¶
PySide6.QtGui.QInputDevice(name, systemId, type[, seatName=””[, parent=None]])
- Parameters
seatName – str
systemId – int
name – str
parent –
PySide6.QtCore.QObject
type –
DeviceType
Creates a new invalid input device instance as a child of parent
.
Creates a new input device instance. The given name
is normally a manufacturer-assigned model name if available, or something else identifiable; id
is a platform-specific number that will be unique per device (for example the xinput ID on X11); type
identifies what kind of device. On window systems that are capable of handling input from multiple users or sets of input devices at the same time (such as Wayland or X11), seatName
identifies the name of the set of devices that will be used together. If the device is a child or slave device (for example one of several mice that can take turns moving the “core pointer”), the master device should be given as the parent
.
The platform plugin creates, registers and continues to own each device instance; usually parent
should be given for memory management purposes even if there is no master for a particular device.
By default, capabilities()
are None
.
- PySide6.QtGui.QInputDevice.DeviceType¶
This enum represents the type of device that generated a QPointerEvent
.
Constant
Description
QInputDevice.DeviceType.Unknown
The device cannot be identified.
QInputDevice.DeviceType.Mouse
A mouse.
QInputDevice.DeviceType.TouchScreen
In this type of device, the touch surface and display are integrated. This means the surface and display typically have the same size, such that there is a direct relationship between the touch points’ physical positions and the coordinate reported by
QEventPoint
. As a result, Qt allows the user to interact directly with multiple QWidgets, QGraphicsItems, or Qt Quick Items at the same time.QInputDevice.DeviceType.TouchPad
In this type of device, the touch surface is separate from the display. There is not a direct relationship between the physical touch location and the on-screen coordinates. Instead, they are calculated relative to the current mouse position, and the user must use the touch-pad to move this reference point. Unlike touch-screens, Qt allows users to only interact with a single
QWidget
orQGraphicsItem
at a time.QInputDevice.DeviceType.Stylus
A pen-like device used on a graphics tablet such as a Wacom tablet, or on a touchscreen that provides a separate stylus sensing capability.
QInputDevice.DeviceType.Airbrush
A stylus with a thumbwheel to adjust
tangentialPressure
.QInputDevice.DeviceType.Puck
A device that is similar to a flat mouse with a transparent circle with cross-hairs.
QInputDevice.DeviceType.Keyboard
A keyboard.
QInputDevice.DeviceType.AllDevices
Any of the above (used as a default filter value).
- PySide6.QtGui.QInputDevice.Capability¶
Indicates what kind of information the input device or its driver can provide.
Constant
Description
QInputDevice.Capability.None
No information about input device capabilities available.
QInputDevice.Capability.Position
Indicates that position information is available, meaning that the position() family of functions in the touch points return valid points.
QInputDevice.Capability.Area
Indicates that touch area information is available, meaning that
ellipseDiameters()
in the touch points return valid values.QInputDevice.Capability.Pressure
Indicates that pressure information is available, meaning that
pressure()
returns a valid value.QInputDevice.Capability.Velocity
Indicates that velocity information is available, meaning that
velocity()
returns a valid vector.QInputDevice.Capability.NormalizedPosition
Indicates that the normalized position is available, meaning that
globalPosition()
returns a valid value.QInputDevice.Capability.MouseEmulation
Indicates that the device synthesizes mouse events.
QInputDevice.Capability.Scroll
Indicates that the device has a scroll capability.
QInputDevice.Capability.PixelScroll
Indicates that the device (usually a
touchpad
) scrolls withpixel precision
.QInputDevice.Capability.Hover
Indicates that the device has a hover capability.
QInputDevice.Capability.Rotation
Indicates that
rotation
information is available.QInputDevice.Capability.XTilt
Indicates that
tilt
information is available for the X-axis.QInputDevice.Capability.YTilt
Indicates that
tilt
information is available for the Y-axis.QInputDevice.Capability.TangentialPressure
Indicates that
tangential pressure
information is available.QInputDevice.Capability.ZPosition
Indicates that position information for the
Z-axis
is available.QInputDevice.Capability.All
- PySide6.QtGui.QInputDevice.availableVirtualGeometry()¶
- Return type
- PySide6.QtGui.QInputDevice.availableVirtualGeometryChanged(area)¶
- Parameters
area –
PySide6.QtCore.QRect
- PySide6.QtGui.QInputDevice.capabilities()¶
- Return type
Capabilities
Returns the device capabilities.
- static PySide6.QtGui.QInputDevice.devices()¶
- Return type
Returns a list of all registered input devices (keyboards and pointing devices).
Note
The returned list cannot be used to add new devices. To add a simulated touch screen for an autotest, createTouchDevice()
can be used. Platform plugins should call to add devices as they are discovered.
- PySide6.QtGui.QInputDevice.hasCapability(cap)¶
- Parameters
cap –
Capability
- Return type
bool
Returns whether the device capabilities include the given capability
.
- PySide6.QtGui.QInputDevice.name()¶
- Return type
str
- PySide6.QtGui.QInputDevice.__eq__(other)¶
- Parameters
other –
PySide6.QtGui.QInputDevice
- Return type
bool
- static PySide6.QtGui.QInputDevice.primaryKeyboard([seatName=""])¶
- Parameters
seatName – str
- Return type
Returns the core or master keyboard on the given seat seatName
.
- PySide6.QtGui.QInputDevice.seatName()¶
- Return type
str
- PySide6.QtGui.QInputDevice.systemId()¶
- Return type
int
- PySide6.QtGui.QInputDevice.type()¶
- Return type
© 2022 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.