Skip to content

PythonQt.Qt.QTabletEvent

QTabletEvent

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

Tablet events are generated from tablet peripherals such as Wacom tablets and various other brands, and electromagnetic stylus devices included with some types of tablet computers. (It is not the same as QTouchEvent which a touchscreen generates, even when a passive stylus is used on a touchscreen.)

Tablet events are similar to mouse events; for example, the x(), y(), pos(), globalX(), globalY(), and globalPos() accessors provide the cursor position, and you can see which buttons() are pressed (pressing the stylus tip against the tablet surface is equivalent to a left mouse button). But tablet events also pass through some extra information that the tablet device driver provides; for example, you might want to do subpixel rendering with higher resolution coordinates (globalPosF()), adjust color brightness based on the pressure() of the tool against the tablet surface, use different brushes depending on the type of tool in use (deviceType()), modulate the brush shape in some way according to the X-axis and Y-axis tilt of the tool with respect to the tablet surface (xTilt() and yTilt()), and use a virtual eraser instead of a brush if the user switches to the other end of a double-ended stylus (pointerType()).

Every event contains an accept flag that indicates whether the receiver wants the event. You should call QTabletEvent::accept() if you handle the tablet event; otherwise it will be sent to the parent widget. The exception are TabletEnterProximity and TabletLeaveProximity events: these are only sent to QApplication and do not check whether or not they are accepted.

The QWidget::setEnabled() function can be used to enable or disable mouse, tablet and keyboard events for a widget.

The event handler QWidget::tabletEvent() receives TabletPress, TabletRelease and TabletMove events. Qt will first send a tablet event, then if it is not accepted by any widget, it will send a mouse event. This allows users of applications that are not designed for tablets to use a tablet like a mouse. However high-resolution drawing applications should handle the tablet events, because they can occur at a higher frequency, which is a benefit for smooth and accurate drawing. If the tablet events are rejected, the synthetic mouse events may be compressed for efficiency.

New in Qt 5.4: QTabletEvent includes all information available from the device, including QTabletEvent::buttons(). Previously it was not possible to accept all tablet events and also know which stylus buttons were pressed.

Note that pressing the stylus button while the stylus hovers over the tablet will generate a button press on some types of tablets, while on other types it will be necessary to press the stylus against the tablet surface in order to register the simultaneous stylus button press.

Notes for X11 Users

If the tablet is configured in xorg.conf to use the Wacom driver, there will be separate XInput "devices" for the stylus, eraser, and (optionally) cursor and touchpad. Qt recognizes these by their names. Otherwise, if the tablet is configured to use the evdev driver, there will be only one device and applications may not be able to distinguish the stylus from the eraser.

Notes for Windows Users

Tablet support currently requires the WACOM windows driver providing the DLL wintab32.dll to be installed. It is contained in older packages, for example pentablet_5.3.5-3.exe.

Source: https://doc.qt.io/archives/qt-5.15/qtabletevent.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
AcceptDropsChange attribute Any (shared captured text)
ActionAdded attribute Any (shared captured text)
ActionChanged attribute Any (shared captured text)
ActionRemoved attribute Any (shared captured text)
ActivateControl attribute Any (shared captured text)
ActivationChange attribute Any (shared captured text)
Airbrush attribute Any (shared captured text)
ApplicationActivate attribute Any (shared captured text)
ApplicationActivated attribute Any (shared captured text)
ApplicationDeactivate attribute Any (shared captured text)
ApplicationDeactivated attribute Any (shared captured text)
ApplicationFontChange attribute Any (shared captured text)
ApplicationLayoutDirectionChange attribute Any (shared captured text)
ApplicationPaletteChange attribute Any (shared captured text)
ApplicationStateChange attribute Any (shared captured text)
ApplicationWindowIconChange attribute Any (shared captured text)
ChildAdded attribute Any (shared captured text)
ChildPolished attribute Any (shared captured text)
ChildRemoved attribute Any (shared captured text)
Clipboard attribute Any (shared captured text)
Close attribute Any (shared captured text)
CloseSoftwareInputPanel attribute Any (shared captured text)
ContentsRectChange attribute Any (shared captured text)
ContextMenu attribute Any (shared captured text)
Create attribute Any (shared captured text)
Cursor attribute Any (shared captured text)
CursorChange attribute Any (shared captured text)
DeactivateControl attribute Any (shared captured text)
DeferredDelete attribute Any (shared captured text)
Destroy attribute Any (shared captured text)
DragEnter attribute Any (shared captured text)
DragLeave attribute Any (shared captured text)
DragMove attribute Any (shared captured text)
DragResponse attribute Any (shared captured text)
Drop attribute Any (shared captured text)
DynamicPropertyChange attribute Any (shared captured text)
EmbeddingControl attribute Any (shared captured text)
EnabledChange attribute Any (shared captured text)
Enter attribute Any (shared captured text)
EnterWhatsThisMode attribute Any (shared captured text)
Eraser attribute Any (shared captured text)
Expose attribute Any (shared captured text)
FileOpen attribute Any (shared captured text)
FocusAboutToChange attribute Any (shared captured text)
FocusIn attribute Any (shared captured text)
FocusOut attribute Any (shared captured text)
FontChange attribute Any (shared captured text)
FourDMouse attribute Any (shared captured text)
FutureCallOut attribute Any (shared captured text)
Gesture attribute Any (shared captured text)
GestureOverride attribute Any (shared captured text)
GrabKeyboard attribute Any (shared captured text)
GrabMouse attribute Any (shared captured text)
GraphicsSceneContextMenu attribute Any (shared captured text)
GraphicsSceneDragEnter attribute Any (shared captured text)
GraphicsSceneDragLeave attribute Any (shared captured text)
GraphicsSceneDragMove attribute Any (shared captured text)
GraphicsSceneDrop attribute Any (shared captured text)
GraphicsSceneHelp attribute Any (shared captured text)
GraphicsSceneHoverEnter attribute Any (shared captured text)
GraphicsSceneHoverLeave attribute Any (shared captured text)
GraphicsSceneHoverMove attribute Any (shared captured text)
GraphicsSceneMouseDoubleClick attribute Any (shared captured text)
GraphicsSceneMouseMove attribute Any (shared captured text)
GraphicsSceneMousePress attribute Any (shared captured text)
GraphicsSceneMouseRelease attribute Any (shared captured text)
GraphicsSceneMove attribute Any (shared captured text)
GraphicsSceneResize attribute Any (shared captured text)
GraphicsSceneWheel attribute Any (shared captured text)
HelpRequest attribute Any (shared captured text)
Hide attribute Any (shared captured text)
HideToParent attribute Any (shared captured text)
HoverEnter attribute Any (shared captured text)
HoverLeave attribute Any (shared captured text)
HoverMove attribute Any (shared captured text)
IconDrag attribute Any (shared captured text)
IconTextChange attribute Any (shared captured text)
InputMethod attribute Any (shared captured text)
InputMethodQuery attribute Any (shared captured text)
KeyPress attribute Any (shared captured text)
KeyRelease attribute Any (shared captured text)
KeyboardLayoutChange attribute Any (shared captured text)
LanguageChange attribute Any (shared captured text)
LayoutDirectionChange attribute Any (shared captured text)
LayoutRequest attribute Any (shared captured text)
Leave attribute Any (shared captured text)
LeaveWhatsThisMode attribute Any (shared captured text)
LocaleChange attribute Any (shared captured text)
MacGLClearDrawable attribute Any (shared captured text)
MacGLWindowChange attribute Any (shared captured text)
MacSizeChange attribute Any (shared captured text)
MaxUser attribute Any (shared captured text)
MetaCall attribute Any (shared captured text)
ModifiedChange attribute Any (shared captured text)
MouseButtonDblClick attribute Any (shared captured text)
MouseButtonPress attribute Any (shared captured text)
MouseButtonRelease attribute Any (shared captured text)
MouseMove attribute Any (shared captured text)
MouseTrackingChange attribute Any (shared captured text)
Move attribute Any (shared captured text)
NativeGesture attribute Any (shared captured text)
NetworkReplyUpdated attribute Any (shared captured text)
NoDevice attribute Any (shared captured text)
NonClientAreaMouseButtonDblClick attribute Any (shared captured text)
NonClientAreaMouseButtonPress attribute Any (shared captured text)
NonClientAreaMouseButtonRelease attribute Any (shared captured text)
NonClientAreaMouseMove attribute Any (shared captured text)
None_ attribute Any (shared captured text)
OkRequest attribute Any (shared captured text)
OrientationChange attribute Any (shared captured text)
Paint attribute Any (shared captured text)
PaletteChange attribute Any (shared captured text)
ParentAboutToChange attribute Any (shared captured text)
ParentChange attribute Any (shared captured text)
Pen attribute Any (shared captured text)
PlatformPanel attribute Any (shared captured text)
PlatformSurface attribute Any (shared captured text)
PointerType attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
Polish attribute Any (shared captured text)
PolishRequest attribute Any (shared captured text)
Puck attribute Any (shared captured text)
QueryWhatsThis attribute Any (shared captured text)
Quit attribute Any (shared captured text)
ReadOnlyChange attribute Any (shared captured text)
RequestSoftwareInputPanel attribute Any (shared captured text)
Resize attribute Any (shared captured text)
RotationStylus attribute Any (shared captured text)
ScreenChangeInternal attribute Any (shared captured text)
Scroll attribute Any (shared captured text)
ScrollPrepare attribute Any (shared captured text)
Shortcut attribute Any (shared captured text)
ShortcutOverride attribute Any (shared captured text)
Show attribute Any (shared captured text)
ShowToParent attribute Any (shared captured text)
ShowWindowRequest attribute Any (shared captured text)
SockAct attribute Any (shared captured text)
SockClose attribute Any (shared captured text)
Speech attribute Any (shared captured text)
StateMachineSignal attribute Any (shared captured text)
StateMachineWrapped attribute Any (shared captured text)
StatusTip attribute Any (shared captured text)
Style attribute Any (shared captured text)
StyleAnimationUpdate attribute Any (shared captured text)
StyleChange attribute Any (shared captured text)
Stylus attribute Any (shared captured text)
TabletDevice attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
TabletEnterProximity attribute Any (shared captured text)
TabletLeaveProximity attribute Any (shared captured text)
TabletMove attribute Any (shared captured text)
TabletPress attribute Any (shared captured text)
TabletRelease attribute Any (shared captured text)
ThemeChange attribute Any (shared captured text)
ThreadChange attribute Any (shared captured text)
Timer attribute Any (shared captured text)
ToolBarChange attribute Any (shared captured text)
ToolTip attribute Any (shared captured text)
ToolTipChange attribute Any (shared captured text)
TouchBegin attribute Any (shared captured text)
TouchCancel attribute Any (shared captured text)
TouchEnd attribute Any (shared captured text)
TouchUpdate attribute Any (shared captured text)
Type attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
UngrabKeyboard attribute Any (shared captured text)
UngrabMouse attribute Any (shared captured text)
UnknownPointer attribute Any (shared captured text)
UpdateLater attribute Any (shared captured text)
UpdateRequest attribute Any (shared captured text)
User attribute Any (shared captured text)
WhatsThis attribute Any (shared captured text)
WhatsThisClicked attribute Any (shared captured text)
Wheel attribute Any (shared captured text)
WinEventAct attribute Any (shared captured text)
WinIdChange attribute Any (shared captured text)
WindowActivate attribute Any (shared captured text)
WindowBlocked attribute Any (shared captured text)
WindowChangeInternal attribute Any (shared captured text)
WindowDeactivate attribute Any (shared captured text)
WindowIconChange attribute Any (shared captured text)
WindowStateChange attribute Any (shared captured text)
WindowTitleChange attribute Any (shared captured text)
WindowUnblocked attribute Any (shared captured text)
XFreeEraser attribute Any (shared captured text)
ZOrderChange attribute Any (shared captured text)
ZeroTimerEvent attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
accept function (self) -> Any (shared captured text)
button function (self) -> Any Returns the button that caused the event. (shared captured text)
buttons function (self) -> Any Returns the button state when the event was generated. (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
device function (self) -> Any (shared captured text)
globalPos function (self) -> Any X.globalPos() -> PythonQt.QtCore.QPoint (shared captured text)
globalPosF function (self) -> Any X.globalPosF() -> PythonQt.QtCore.QPointF (shared captured text)
globalX function (self) -> int X.globalX() -> int (shared captured text)
globalY function (self) -> int X.globalY() -> int (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
hiResGlobalX function (self) -> float X.hiResGlobalX() -> float (shared captured text)
hiResGlobalY function (self) -> float X.hiResGlobalY() -> float (shared captured text)
ignore function (self) -> Any (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
isAccepted function (self) -> bool X.isAccepted() -> bool (shared captured text)
modifiers function (self) -> Any (shared captured text)
operator_assign function (self, other: Any) -> Any X.operator_assign(other) -> PythonQt.QtCore.QEvent (shared captured text)
pointerType function (self) -> Any Returns the type of point that generated the event. (shared captured text)
pos function (self) -> Any X.pos() -> PythonQt.QtCore.QPoint (shared captured text)
posF function (self) -> Any X.posF() -> PythonQt.QtCore.QPointF (shared captured text)
pressure function (self) -> float X.pressure() -> float (shared captured text)
registerEventType function (self, hint: Any) -> int X.registerEventType(hint) -> int (shared captured text)
rotation function (self) -> float X.rotation() -> float (shared captured text)
setAccepted function (self, accepted: Any) -> Any (shared captured text)
setModifiers function (self, amodifiers: Any) -> Any (shared captured text)
setTimestamp function (self, atimestamp: Any) -> Any (shared captured text)
spontaneous function (self) -> bool X.spontaneous() -> bool (shared captured text)
tangentialPressure function (self) -> float X.tangentialPressure() -> float (shared captured text)
timestamp function (self) -> int X.timestamp() -> int (shared captured text)
type function (self) -> Any (shared captured text)
uniqueId function (self) -> int X.uniqueId() -> int (shared captured text)
x function (self) -> int X.x() -> int (shared captured text)
xTilt function (self) -> int X.xTilt() -> int (shared captured text)
y function (self) -> int X.y() -> int (shared captured text)
yTilt function (self) -> int X.yTilt() -> int (shared captured text)
z function (self) -> int X.z() -> int (shared captured text)