CopperSpice API  1.9.1
QTabletEvent Class Reference

Parameters that describe a Tablet event. More...

Inheritance diagram for QTabletEvent:
QInputEvent QEvent

Public Types

enum  PointerType
 
enum  TabletDevice
 
- Public Types inherited from QEvent
enum  Type
 

Public Methods

 QTabletEvent (Type type, const QPointF &pos, const QPointF &globalPos, int device, int pointerType, qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID, Qt::MouseButton button=Qt::NoButton, Qt::MouseButtons buttons=Qt::NoButton)
 
Qt::MouseButton button () const
 
Qt::MouseButtons buttons () const
 
TabletDevice device () const
 
QPoint globalPos () const
 
const QPointFglobalPosF () const
 
int globalX () const
 
int globalY () const
 
qreal hiResGlobalX () const
 
qreal hiResGlobalY () const
 
PointerType pointerType () const
 
QPoint pos () const
 
const QPointFposF () const
 
qreal pressure () const
 
qreal rotation () const
 
qreal tangentialPressure () const
 
qint64 uniqueId () const
 
int x () const
 
int xTilt () const
 
int y () const
 
int yTilt () const
 
int z () const
 
- Public Methods inherited from QInputEvent
Qt::KeyboardModifiers modifiers () const
 
void setModifiers (Qt::KeyboardModifiers modifiers)
 
void setTimestamp (ulong timestamp)
 
ulong timestamp () const
 
- Public Methods inherited from QEvent
 QEvent (const QEvent &other)
 
 QEvent (Type type)
 
virtual ~QEvent ()
 
void accept ()
 
void ignore ()
 
bool isAccepted () const
 
QEvent & operator= (const QEvent &other)
 
void setAccepted (bool accepted)
 
bool spontaneous () const
 
Type type () const
 

Additional Inherited Members

- Static Public Methods inherited from QEvent
static int registerEventType (int hint=-1)
 

Detailed Description

The QTabletEvent class contains parameters that describe a Tablet event.

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 do not 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. CopperSpice will first send a tabletEvent then, if it is not accepted, it will send a mouse event. This allows applications that do not 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

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

See also
pointerType()

Member Enumeration Documentation

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

ConstantValueDescription
QTabletEvent::UnknownPointer0An unknown device.
QTabletEvent::Pen1Tip end of a stylus-like device (the narrow end of the pen).
QTabletEvent::Cursor2Any puck-like device.
QTabletEvent::Eraser3Eraser end of a stylus-like device (the broad end of the pen).
See also
pointerType()

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

ConstantValueDescription
QTabletEvent::NoDevice0No device, or an unknown device.
QTabletEvent::Puck1A Puck (a device that is similar to a flat mouse with a transparent circle with cross-hairs).
QTabletEvent::Stylus2A Stylus.
QTabletEvent::Airbrush3An airbrush
QTabletEvent::FourDMouse4A 4D Mouse.
QTabletEvent::RotationStylus6A special stylus that also knows about rotation (a 6D stylus).

Constructor & Destructor Documentation

QTabletEvent::QTabletEvent ( Type  type,
const QPointF pos,
const QPointF globalPos,
int  device,
int  pointerType,
qreal  pressure,
int  xTilt,
int  yTilt,
qreal  tangentialPressure,
qreal  rotation,
int  z,
Qt::KeyboardModifiers  keyState,
qint64  uniqueID,
Qt::MouseButton  button = Qt::NoButton,
Qt::MouseButtons  buttons = Qt::NoButton 
)

Constructs a QTabletEvent with the given type. The pos parameter indicates where the event occurred relative to the widget and globalPos is the corresponding position in absolute coordinates.

The value for pressure indicates the amount of force exerted on the device and the pointerType describes the type of stylus being used. The xTilt and yTilt represent the degree of tilt from the x and y axes and the keyState specifies which keyboard modifiers are pressed.

If a unique ID for the current device is available it should be specified in uniqueID. The value for z should contain the Z coordinate if the device supports 3D movement. If the device does not support a Z-axis, pass zero here.

The tangentialPressure parameter indicates the pressure control of a simulated air brush. If the device does not support this control then 0 should be passed. The value for rotation contains the number of degrees of rotation for a 4D mouse. If the device does not support this control the value of 0 should be passed.

The button which caused the event is supplied as a value from the Qt::MouseButton enum. If the event type is not a TabletPress or TabletRelease, the appropriate button for this event is Qt::NoButton. The parameter buttons indicates the state of all buttons at the time of the event.

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

Method Documentation

Qt::MouseButton QTabletEvent::button ( ) const

Returns the button that caused the event. The returned value is always Qt::NoButton for TabletMove, TabletEnterProximity and TabletLeaveProximity events.

See also
buttons(), Qt::MouseButton
Qt::MouseButtons QTabletEvent::buttons ( ) const

Returns the button state when the event was generated. The button state is a combination of buttons from the Qt::MouseButton enum using the OR operator. For TabletMove events, this is all buttons that are pressed down. For TabletPress events this includes the button that caused the event. For TabletRelease events this excludes the button that caused the event.

See also
button(), Qt::MouseButton
TabletDevice QTabletEvent::device ( ) const
inline

Returns the type of device that generated the event.

See also
TabletDevice
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()
const QPointF & QTabletEvent::globalPosF ( ) 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 widgets are moved around in response to mouse events, globalPosF() can differ from the current cursor position returned by QCursor::pos().

See also
posF()
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()
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()
qreal QTabletEvent::hiResGlobalX ( ) const
inline

The high precision x position of the tablet device.

qreal QTabletEvent::hiResGlobalY ( ) const
inline

The high precision y position of the tablet device.

PointerType QTabletEvent::pointerType ( ) const
inline

Returns the type of point that generated the event.

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()
const QPointF & QTabletEvent::posF ( ) const
inline

Returns the position of the device, relative to the widget that received the event. If widgets are moved around in response to mouse events, use the global position returned by globalPosF() instead of this method.

See also
globalPosF()
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()
qreal QTabletEvent::rotation ( ) const
inline

Returns the rotation of the current device in degrees. This is usually given by a 4D Mouse. If the device does not support rotation this value is always 0.0.

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 neutral position. If the device does not support tangential pressure, this value is always 0.0.

See also
pressure()
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 depends on the tablet and values for the same device may vary from OS to OS.

Later versions of the Wacom driver for Linux will 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.

The unique ID is the same regardless of the orientation of the pen.

See also
pointerType()
int QTabletEvent::x ( ) const
inline

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

See also
y(), pos()
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.

See also
yTilt()
int QTabletEvent::y ( ) const
inline

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

See also
x(), pos()
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()
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()