Qt 4.8
Public Types | Public Functions | Protected Variables | List of all members
QTabletEvent Class Reference

The QTabletEvent class contains parameters that describe a Tablet event. More...

#include <qevent.h>

Inheritance diagram for QTabletEvent:
QInputEvent QEvent

Public Types

enum  PointerType { UnknownPointer, Pen, Cursor, Eraser }
 This enum defines what type of point is generating the event. More...
 
enum  TabletDevice {
  NoDevice, Puck, Stylus, Airbrush,
  FourDMouse, XFreeEraser, RotationStylus
}
 This enum defines what type of device is generating the event. More...
 
- Public Types inherited from QEvent
enum  Type {
  None = 0, Timer = 1, MouseButtonPress = 2, MouseButtonRelease = 3,
  MouseButtonDblClick = 4, MouseMove = 5, KeyPress = 6, KeyRelease = 7,
  FocusIn = 8, FocusOut = 9, Enter = 10, Leave = 11,
  Paint = 12, Move = 13, Resize = 14, Create = 15,
  Destroy = 16, Show = 17, Hide = 18, Close = 19,
  Quit = 20, ParentChange = 21, ParentAboutToChange = 131, ThreadChange = 22,
  WindowActivate = 24, WindowDeactivate = 25, ShowToParent = 26, HideToParent = 27,
  Wheel = 31, WindowTitleChange = 33, WindowIconChange = 34, ApplicationWindowIconChange = 35,
  ApplicationFontChange = 36, ApplicationLayoutDirectionChange = 37, ApplicationPaletteChange = 38, PaletteChange = 39,
  Clipboard = 40, Speech = 42, MetaCall = 43, SockAct = 50,
  WinEventAct = 132, DeferredDelete = 52, DragEnter = 60, DragMove = 61,
  DragLeave = 62, Drop = 63, DragResponse = 64, ChildAdded = 68,
  ChildPolished = 69, ChildRemoved = 71, ShowWindowRequest = 73, PolishRequest = 74,
  Polish = 75, LayoutRequest = 76, UpdateRequest = 77, UpdateLater = 78,
  EmbeddingControl = 79, ActivateControl = 80, DeactivateControl = 81, ContextMenu = 82,
  InputMethod = 83, AccessibilityPrepare = 86, TabletMove = 87, LocaleChange = 88,
  LanguageChange = 89, LayoutDirectionChange = 90, Style = 91, TabletPress = 92,
  TabletRelease = 93, OkRequest = 94, HelpRequest = 95, IconDrag = 96,
  FontChange = 97, EnabledChange = 98, ActivationChange = 99, StyleChange = 100,
  IconTextChange = 101, ModifiedChange = 102, MouseTrackingChange = 109, WindowBlocked = 103,
  WindowUnblocked = 104, WindowStateChange = 105, ToolTip = 110, WhatsThis = 111,
  StatusTip = 112, ActionChanged = 113, ActionAdded = 114, ActionRemoved = 115,
  FileOpen = 116, Shortcut = 117, ShortcutOverride = 51, WhatsThisClicked = 118,
  ToolBarChange = 120, ApplicationActivate = 121, ApplicationActivated = ApplicationActivate, ApplicationDeactivate = 122,
  ApplicationDeactivated = ApplicationDeactivate, QueryWhatsThis = 123, EnterWhatsThisMode = 124, LeaveWhatsThisMode = 125,
  ZOrderChange = 126, HoverEnter = 127, HoverLeave = 128, HoverMove = 129,
  AccessibilityHelp = 119, AccessibilityDescription = 130, AcceptDropsChange = 152, MenubarUpdated = 153,
  ZeroTimerEvent = 154, GraphicsSceneMouseMove = 155, GraphicsSceneMousePress = 156, GraphicsSceneMouseRelease = 157,
  GraphicsSceneMouseDoubleClick = 158, GraphicsSceneContextMenu = 159, GraphicsSceneHoverEnter = 160, GraphicsSceneHoverMove = 161,
  GraphicsSceneHoverLeave = 162, GraphicsSceneHelp = 163, GraphicsSceneDragEnter = 164, GraphicsSceneDragMove = 165,
  GraphicsSceneDragLeave = 166, GraphicsSceneDrop = 167, GraphicsSceneWheel = 168, KeyboardLayoutChange = 169,
  DynamicPropertyChange = 170, TabletEnterProximity = 171, TabletLeaveProximity = 172, NonClientAreaMouseMove = 173,
  NonClientAreaMouseButtonPress = 174, NonClientAreaMouseButtonRelease = 175, NonClientAreaMouseButtonDblClick = 176, MacSizeChange = 177,
  ContentsRectChange = 178, MacGLWindowChange = 179, FutureCallOut = 180, GraphicsSceneResize = 181,
  GraphicsSceneMove = 182, CursorChange = 183, ToolTipChange = 184, NetworkReplyUpdated = 185,
  GrabMouse = 186, UngrabMouse = 187, GrabKeyboard = 188, UngrabKeyboard = 189,
  MacGLClearDrawable = 191, StateMachineSignal = 192, StateMachineWrapped = 193, TouchBegin = 194,
  TouchUpdate = 195, TouchEnd = 196, NativeGesture = 197, RequestSoftwareInputPanel = 199,
  CloseSoftwareInputPanel = 200, UpdateSoftKeys = 201, WinIdChange = 203, Gesture = 198,
  GestureOverride = 202, PlatformPanel = 212, User = 1000, MaxUser = 65535
}
 This enum type defines the valid event types in Qt. More...
 

Public Functions

TabletDevice device () const
 Returns the type of device that generated the event. More...
 
const QPointglobalPos () const
 Returns the global position of the device at the time of the event. More...
 
int globalX () const
 Returns the global x position of the mouse pointer at the time of the event. More...
 
int globalY () const
 Returns the global y position of the tablet device at the time of the event. More...
 
const QPointFhiResGlobalPos () const
 The high precision coordinates delivered from the tablet expressed. More...
 
qreal hiResGlobalX () const
 The high precision x position of the tablet device. More...
 
qreal hiResGlobalY () const
 The high precision y position of the tablet device. More...
 
PointerType pointerType () const
 Returns the type of point that generated the event. More...
 
const QPointpos () const
 Returns the position of the device, relative to the widget that received the event. More...
 
qreal pressure () const
 Returns the pressure for the device. More...
 
 QTabletEvent (Type t, const QPoint &pos, const QPoint &globalPos, const QPointF &hiResGlobalPos, int device, int pointerType, qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID)
 Construct a tablet event of the given type. More...
 
qreal rotation () const
 Returns the rotation of the current device in degress. More...
 
qreal tangentialPressure () const
 Returns the tangential pressure for the device. More...
 
qint64 uniqueId () const
 Returns a unique ID for the current device, making it possible to differentiate between multiple devices being used at the same time on the tablet. More...
 
int x () const
 Returns the x position of the device, relative to the widget that received the event. More...
 
int xTilt () const
 Returns the angle between the device (a pen, for example) and the perpendicular in the direction of the x axis. More...
 
int y () const
 Returns the y position of the device, relative to the widget that received the event. More...
 
int yTilt () const
 Returns the angle between the device (a pen, for example) and the perpendicular in the direction of the y axis. More...
 
int z () const
 Returns the z position of the device. More...
 
 ~QTabletEvent ()
 
- Public Functions inherited from QInputEvent
Qt::KeyboardModifiers modifiers () const
 Returns the keyboard modifier flags that existed immediately before the event occurred. More...
 
 QInputEvent (Type type, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
 
void setModifiers (Qt::KeyboardModifiers amodifiers)
 Sets the keyboard modifiers flags for this event. More...
 
 ~QInputEvent ()
 
- Public Functions inherited from QEvent
void accept ()
 Sets the accept flag of the event object, the equivalent of calling setAccepted(true). More...
 
void ignore ()
 Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false). More...
 
bool isAccepted () const
 
 QEvent (Type type)
 Contructs an event object of type type. More...
 
void setAccepted (bool accepted)
 
bool spontaneous () const
 Returns true if the event originated outside the application (a system event); otherwise returns false. More...
 
Type type () const
 Returns the event type. More...
 
virtual ~QEvent ()
 Destroys the event. More...
 

Protected Variables

int mDev
 
void * mExtra
 
QPoint mGPos
 
QPointF mHiResGlobalPos
 
int mPointerType
 
QPoint mPos
 
qreal mPress
 
qreal mRot
 
qreal mTangential
 
qint64 mUnique
 
int mXT
 
int mYT
 
int mZ
 
- Protected Variables inherited from QInputEvent
Qt::KeyboardModifiers modState
 
- Protected Variables inherited from QEvent
QEventPrivate * d
 
ushort t
 

Additional Inherited Members

- Static Public Functions inherited from QEvent
static int registerEventType (int hint=-1)
 Registers and returns a custom event type. More...
 

Detailed Description

The QTabletEvent class contains parameters that describe a Tablet event.

Tablet Events are generated from a Wacom tablet. Most of the time you will want to deal with events from the tablet as if they were events from a mouse; for example, you would retrieve the cursor position with x(), y(), pos(), globalX(), globalY(), and globalPos(). In some situations you may wish to retrieve the extra information provided by the tablet device driver; for example, you might want to do subpixeling with higher resolution coordinates or you may want to adjust color brightness based on pressure. QTabletEvent allows you to read the pressure(), the xTilt(), and yTilt(), as well as the type of device being used with device() (see TabletDevice). It can also give you the minimum and maximum values for each device's pressure and high resolution coordinates.

A tablet event contains a special 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 don't check whether or not they are accepted.

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

The event handler QWidget::tabletEvent() receives all three types of tablet events. Qt will first send a tabletEvent then, if it is not accepted, it will send a mouse event. This allows applications that don't utilize tablets to use a tablet like a mouse, while also enabling those who want to use both tablets and mouses differently.

Notes for X11 Users

Qt uses the following hard-coded names to identify tablet devices from the xorg.conf file on X11 (apart from IRIX): 'stylus', 'pen', and 'eraser'. If the devices have other names, they will not be picked up Qt.

Definition at line 179 of file qevent.h.

Enumerations

◆ PointerType

This enum defines what type of point is generating the event.

  • UnknownPointer An unknown device.
  • Pen Tip end of a stylus-like device (the narrow end of the pen).
  • Cursor Any puck-like device.
  • Eraser Eraser end of a stylus-like device (the broad end of the pen).
See also
pointerType()
Enumerator
UnknownPointer 
Pen 
Cursor 
Eraser 

Definition at line 184 of file qevent.h.

◆ TabletDevice

This enum defines what type of device is generating the event.

  • NoDevice No device, or an unknown device.
  • Puck A Puck (a device that is similar to a flat mouse with a transparent circle with cross-hairs).
  • Stylus A Stylus.
  • Airbrush An airbrush
  • FourDMouse A 4D Mouse.
  • RotationStylus A special stylus that also knows about rotation (a 6D stylus).
    Since
    4.1
  • XFreeEraser
Enumerator
NoDevice 
Puck 
Stylus 
Airbrush 
FourDMouse 
XFreeEraser 
RotationStylus 

Definition at line 182 of file qevent.h.

Constructors and Destructors

◆ QTabletEvent()

QTabletEvent::QTabletEvent ( Type  type,
const QPoint pos,
const QPoint globalPos,
const QPointF hiResGlobalPos,
int  device,
int  pointerType,
qreal  pressure,
int  xTilt,
int  yTilt,
qreal  tangentialPressure,
qreal  rotation,
int  z,
Qt::KeyboardModifiers  keyState,
qint64  uniqueID 
)

Construct a tablet event of the given type.

The pos parameter indicates where the event occurred in the widget; globalPos is the corresponding position in absolute coordinates. The hiResGlobalPos contains a high resolution measurement of the position.

pressure contains the pressure exerted on the device.

pointerType describes the type of pen that is being used.

xTilt and yTilt contain the device's degree of tilt from the x and y axes respectively.

keyState specifies which keyboard modifiers are pressed (e.g., Ctrl).

The uniqueID parameter contains the unique ID for the current device.

The z parameter contains the coordinate of the device on the tablet, this is usually given by a wheel on 4D mouse. If the device does not support a Z-axis, pass zero here.

The tangentialPressure parameter contins the tangential pressure of an air brush. If the device does not support tangential pressure, pass 0 here.

rotation contains the device's rotation in degrees. 4D mice support rotation. If the device does not support rotation, pass 0 here.

See also
pos() globalPos() device() pressure() xTilt() yTilt() uniqueId(), rotation(), tangentialPressure(), z()

Definition at line 2228 of file qevent.cpp.

2232  : QInputEvent(type, keyState),
2233  mPos(pos),
2234  mGPos(globalPos),
2235  mHiResGlobalPos(hiResGlobalPos),
2236  mDev(device),
2238  mXT(xTilt),
2239  mYT(yTilt),
2240  mZ(z),
2241  mPress(pressure),
2243  mRot(rotation),
2244  mUnique(uniqueID),
2245  mExtra(0)
2246 {
2247 }
int xTilt() const
Returns the angle between the device (a pen, for example) and the perpendicular in the direction of t...
Definition: qevent.h:207
int mDev
Definition: qevent.h:213
qint64 mUnique
Definition: qevent.h:215
QPoint mGPos
Definition: qevent.h:211
PointerType pointerType() const
Returns the type of point that generated the event.
Definition: qevent.h:201
qreal mPress
Definition: qevent.h:214
int mPointerType
Definition: qevent.h:213
QPoint mPos
Definition: qevent.h:211
QPointF mHiResGlobalPos
Definition: qevent.h:212
qreal pressure() const
Returns the pressure for the device.
Definition: qevent.h:203
int z() const
Returns the z position of the device.
Definition: qevent.h:204
QInputEvent(Type type, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
Definition: qevent.cpp:77
void * mExtra
Definition: qevent.h:220
int yTilt() const
Returns the angle between the device (a pen, for example) and the perpendicular in the direction of t...
Definition: qevent.h:208
qreal tangentialPressure() const
Returns the tangential pressure for the device.
Definition: qevent.h:205
qreal mRot
Definition: qevent.h:214
qreal rotation() const
Returns the rotation of the current device in degress.
Definition: qevent.h:206
qreal mTangential
Definition: qevent.h:214
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
TabletDevice device() const
Returns the type of device that generated the event.
Definition: qevent.h:200

◆ ~QTabletEvent()

QTabletEvent::~QTabletEvent ( )
Warning
This function is not part of the public interface.

Definition at line 2252 of file qevent.cpp.

2253 {
2254 }

Functions

◆ device()

TabletDevices QTabletEvent::device ( ) const
inline

Returns the type of device that generated the event.

See also
TabletDevice

Definition at line 200 of file qevent.h.

Referenced by QApplication::notify().

200 { return TabletDevice(mDev); }
TabletDevice
This enum defines what type of device is generating the event.
Definition: qevent.h:182
int mDev
Definition: qevent.h:213

◆ globalPos()

const QPoint & QTabletEvent::globalPos ( ) const
inline

Returns the global position of the device at the time of the event.

This is important on asynchronous windows systems like X11; whenever you move your widgets around in response to mouse events, globalPos() can differ significantly from the current position QCursor::pos().

See also
globalX() globalY() hiResGlobalPos()

Definition at line 192 of file qevent.h.

Referenced by QApplication::notify().

192 { return mGPos; }
QPoint mGPos
Definition: qevent.h:211

◆ globalX()

int QTabletEvent::globalX ( ) const
inline

Returns the global x position of the mouse pointer at the time of the event.

See also
globalY() globalPos() hiResGlobalX()

Definition at line 196 of file qevent.h.

196 { return mGPos.x(); }
QPoint mGPos
Definition: qevent.h:211
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128

◆ globalY()

int QTabletEvent::globalY ( ) const
inline

Returns the global y position of the tablet device at the time of the event.

See also
globalX() globalPos() hiResGlobalY()

Definition at line 197 of file qevent.h.

197 { return mGPos.y(); }
QPoint mGPos
Definition: qevent.h:211
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131

◆ hiResGlobalPos()

const QPointF & QTabletEvent::hiResGlobalPos ( ) const
inline

The high precision coordinates delivered from the tablet expressed.

Sub pixeling information is in the fractional part of the QPointF.

See also
globalPos() hiResGlobalX() hiResGlobalY()

Definition at line 193 of file qevent.h.

Referenced by QApplication::notify().

193 { return mHiResGlobalPos; }
QPointF mHiResGlobalPos
Definition: qevent.h:212

◆ hiResGlobalX()

qreal & QTabletEvent::hiResGlobalX ( ) const
inline

The high precision x position of the tablet device.

Definition at line 198 of file qevent.h.

198 { return mHiResGlobalPos.x(); }
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
QPointF mHiResGlobalPos
Definition: qevent.h:212

◆ hiResGlobalY()

qreal & QTabletEvent::hiResGlobalY ( ) const
inline

The high precision y position of the tablet device.

Definition at line 199 of file qevent.h.

199 { return mHiResGlobalPos.y(); }
QPointF mHiResGlobalPos
Definition: qevent.h:212
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287

◆ pointerType()

PointerType QTabletEvent::pointerType ( ) const
inline

Returns the type of point that generated the event.

Definition at line 201 of file qevent.h.

Referenced by QApplication::notify().

201 { return PointerType(mPointerType); }
int mPointerType
Definition: qevent.h:213
PointerType
This enum defines what type of point is generating the event.
Definition: qevent.h:184

◆ pos()

const QPoint & QTabletEvent::pos ( ) const
inline

Returns the position of the device, relative to the widget that received the event.

If you move widgets around in response to mouse events, use globalPos() instead of this function.

See also
x() y() globalPos()

Definition at line 191 of file qevent.h.

Referenced by QApplication::notify().

191 { return mPos; }
QPoint mPos
Definition: qevent.h:211

◆ pressure()

qreal QTabletEvent::pressure ( ) const
inline

Returns the pressure for the device.

0.0 indicates that the stylus is not on the tablet, 1.0 indicates the maximum amount of pressure for the stylus.

See also
tangentialPressure()

Definition at line 203 of file qevent.h.

Referenced by QApplication::notify().

203 { return mPress; }
qreal mPress
Definition: qevent.h:214

◆ rotation()

qreal QTabletEvent::rotation ( ) const
inline

Returns the rotation of the current device in degress.

This is usually given by a 4D Mouse. If the device doesn't support rotation this value is always 0.0.

Definition at line 206 of file qevent.h.

Referenced by QApplication::notify().

206 { return mRot; }
qreal mRot
Definition: qevent.h:214

◆ tangentialPressure()

qreal QTabletEvent::tangentialPressure ( ) const
inline

Returns the tangential pressure for the device.

This is typically given by a finger wheel on an airbrush tool. The range is from -1.0 to 1.0. 0.0 indicates a neutral position. Current airbrushes can only move in the positive direction from the neutrual position. If the device does not support tangential pressure, this value is always 0.0.

See also
pressure()

Definition at line 205 of file qevent.h.

Referenced by QApplication::notify().

205 { return mTangential; }
qreal mTangential
Definition: qevent.h:214

◆ uniqueId()

qint64 QTabletEvent::uniqueId ( ) const
inline

Returns a unique ID for the current device, making it possible to differentiate between multiple devices being used at the same time on the tablet.

Support of this feature is dependent on the tablet.

Values for the same device may vary from OS to OS.

Later versions of the Wacom driver for Linux will now report the ID information. If you have a tablet that supports unique ID and are not getting the information on Linux, consider upgrading your driver.

As of Qt 4.2, the unique ID is the same regardless of the orientation of the pen. Earlier versions would report a different value when using the eraser-end versus the pen-end of the stylus on some OS's.

See also
pointerType()

Definition at line 202 of file qevent.h.

Referenced by QApplication::notify().

202 { return mUnique; }
qint64 mUnique
Definition: qevent.h:215

◆ x()

int QTabletEvent::x ( ) const
inline

Returns the x position of the device, relative to the widget that received the event.

See also
y() pos()

Definition at line 194 of file qevent.h.

194 { return mPos.x(); }
QPoint mPos
Definition: qevent.h:211
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128

◆ xTilt()

int QTabletEvent::xTilt ( ) const
inline

Returns the angle between the device (a pen, for example) and the perpendicular in the direction of the x axis.

Positive values are towards the tablet's physical right. The angle is in the range -60 to +60 degrees.

qtabletevent-tilt.png
See also
yTilt()

Definition at line 207 of file qevent.h.

Referenced by QApplication::notify().

207 { return mXT; }

◆ y()

int QTabletEvent::y ( ) const
inline

Returns the y position of the device, relative to the widget that received the event.

See also
x() pos()

Definition at line 195 of file qevent.h.

195 { return mPos.y(); }
QPoint mPos
Definition: qevent.h:211
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131

◆ yTilt()

int QTabletEvent::yTilt ( ) const
inline

Returns the angle between the device (a pen, for example) and the perpendicular in the direction of the y axis.

Positive values are towards the bottom of the tablet. The angle is within the range -60 to +60 degrees.

See also
xTilt()

Definition at line 208 of file qevent.h.

Referenced by QApplication::notify().

208 { return mYT; }

◆ z()

int QTabletEvent::z ( ) const
inline

Returns the z position of the device.

Typically this is represented by a wheel on a 4D Mouse. If the device does not support a Z-axis, this value is always zero. This is not the same as pressure.

See also
pressure()

Definition at line 204 of file qevent.h.

Referenced by QApplication::notify().

204 { return mZ; }

Properties

◆ mDev

int QTabletEvent::mDev
protected

Definition at line 213 of file qevent.h.

◆ mExtra

void* QTabletEvent::mExtra
protected

Definition at line 220 of file qevent.h.

◆ mGPos

QPoint QTabletEvent::mGPos
protected

Definition at line 211 of file qevent.h.

◆ mHiResGlobalPos

QPointF QTabletEvent::mHiResGlobalPos
protected

Definition at line 212 of file qevent.h.

◆ mPointerType

int QTabletEvent::mPointerType
protected

Definition at line 213 of file qevent.h.

◆ mPos

QPoint QTabletEvent::mPos
protected

Definition at line 211 of file qevent.h.

◆ mPress

qreal QTabletEvent::mPress
protected

Definition at line 214 of file qevent.h.

◆ mRot

qreal QTabletEvent::mRot
protected

Definition at line 214 of file qevent.h.

◆ mTangential

qreal QTabletEvent::mTangential
protected

Definition at line 214 of file qevent.h.

◆ mUnique

qint64 QTabletEvent::mUnique
protected

Definition at line 215 of file qevent.h.

◆ mXT

int QTabletEvent::mXT
protected

Definition at line 213 of file qevent.h.

◆ mYT

int QTabletEvent::mYT
protected

Definition at line 213 of file qevent.h.

◆ mZ

int QTabletEvent::mZ
protected

Definition at line 213 of file qevent.h.


The documentation for this class was generated from the following files: