QInputDevice

The QInputDevice class describes a device from which a QInputEvent originates. More

Inheritance diagram of PySide6.QtGui.QInputDevice

Inherited by: QPointingDevice

Synopsis

Functions

Signals

Static functions

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

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 or QGraphicsItem 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 with pixel 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.QtCore.QRect

PySide6.QtGui.QInputDevice.availableVirtualGeometryChanged(area)
Parameters

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

capCapability

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

otherPySide6.QtGui.QInputDevice

Return type

bool

static PySide6.QtGui.QInputDevice.primaryKeyboard([seatName=""])
Parameters

seatName – str

Return type

PySide6.QtGui.QInputDevice

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

DeviceType