QInputDevice#
The QInputDevice
class describes a device from which a QInputEvent
originates. More…
Inherited by: QPointingDevice
Synopsis#
Properties#
Functions#
def
availableVirtualGeometry
()def
capabilities
()def
hasCapability
(cap)def
name
()def
__eq__
(other)def
seatName
()def
systemId
()def
type
()
Signals#
def
availableVirtualGeometryChanged
(area)
Static functions#
def
devices
()def
primaryKeyboard
([seatName=””])def
seatNames
()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
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 QWindowSystemInterface::registerInputDevice(), 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:
name – str
type –
DeviceType
systemId – int
seatName – str
parent –
PySide6.QtCore.QObject
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
.
Note
Properties can be used directly when from __feature__ import true_property
is used or via accessor functions otherwise.
- property PᅟySide6.QtGui.QInputDevice.availableVirtualGeometry: PySide6.QtCore.QRect#
- Access functions:
Signal
availableVirtualGeometryChanged
(area)
- property PᅟySide6.QtGui.QInputDevice.capabilities: ConnectionCapabilities#
- Access functions:
capabilities
()
- property PᅟySide6.QtGui.QInputDevice.name: str#
- Access functions:
name
()
- property PᅟySide6.QtGui.QInputDevice.seatName: str#
- Access functions:
seatName
()
- property PᅟySide6.QtGui.QInputDevice.systemId: int#
- Access functions:
systemId
()
- property PᅟySide6.QtGui.QInputDevice.type: DeviceType#
- Access functions:
type
()
- PySide6.QtGui.QInputDevice.DeviceType#
(inherits enum.Flag
) 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#
(inherits enum.Flag
) 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:
Returns the region within the virtual desktop
that this device can access.
For example a TouchScreen
input device is fixed in place upon a single physical screen, and usually calibrated so that this area is the same as geometry()
; whereas a Mouse
can probably access all screens on the virtual desktop. A Wacom graphics tablet may be configured in a way that it’s mapped to all screens, or only to the screen where the user prefers to create drawings, or to the window in which drawing occurs. A Stylus
device that is integrated with a touchscreen may be physically limited to that screen.
If the returned rectangle is null
, it means this device can access the entire virtual desktop.
Getter of property availableVirtualGeometry
.
- PySide6.QtGui.QInputDevice.availableVirtualGeometryChanged(area)#
- Parameters:
area –
PySide6.QtCore.QRect
Notification signal of property availableVirtualGeometry
.
- PySide6.QtGui.QInputDevice.capabilities()#
- Return type:
Capabilities
Returns the device capabilities.
- static PySide6.QtGui.QInputDevice.devices()#
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 QWindowSystemInterface::registerInputDevice() 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
Returns the device name.
This string may be empty. It is however useful on systems that have multiple input devices: it can be used to differentiate from which device a QPointerEvent
originates.
Getter of property name
.
- 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
Returns the seat with which the device is associated, if known; otherwise empty.
Devices that are intended to be used together by one user may be configured to have the same seat name. That is only possible on Wayland and X11 platforms so far.
Getter of property seatName
.
- static PySide6.QtGui.QInputDevice.seatNames()#
- Return type:
list of strings
Returns a list of seat names for all registered input devices (keyboards and pointing devices).
- PySide6.QtGui.QInputDevice.systemId()#
- Return type:
int
Returns the platform specific system ID (for example xinput ID on the X11 platform).
All platforms are expected to provide a unique system ID for each device.
Getter of property systemId
.
- PySide6.QtGui.QInputDevice.type()#
- Return type:
Returns the device type.
Getter of property type
.