Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QTabletEvent Class

TheQTabletEvent class contains parameters that describe a Tablet event.More...

Header:#include <QTabletEvent>
Inherits:QInputEvent

Public Types

enumPointerType { UnknownPointer, Pen, Cursor, Eraser }
enumTabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse, RotationStylus }

Public Functions

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)
TabletDevicedevice() const
const QPoint &globalPos() const
intglobalX() const
intglobalY() const
const QPointF &hiResGlobalPos() const
qrealhiResGlobalX() const
qrealhiResGlobalY() const
PointerTypepointerType() const
const QPoint &pos() const
qrealpressure() const
qrealrotation() const
qrealtangentialPressure() const
qint64uniqueId() const
intx() const
intxTilt() const
inty() const
intyTilt() const
intz() const

Additional Inherited Members

  • 1 property inherited fromQEvent
  • 1 static public member inherited fromQEvent

Detailed Description

TheQTabletEvent 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 withx(),y(),pos(),globalX(),globalY(), andglobalPos(). 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 thepressure(), thexTilt(), andyTilt(), as well as the type of device being used withdevice() (seeTabletDevice). 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 callQTabletEvent::accept() if you handle the tablet event; otherwise it will be sent to the parent widget. The exception areTabletEnterProximity andTabletLeaveProximity events, these are only sent toQApplication and don't check whether or not they are accepted.

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

The event handlerQWidget::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.

Member Type Documentation

enum QTabletEvent::PointerType

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 alsopointerType().

enum QTabletEvent::TabletDevice

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

This enum was introduced or modified in Qt 4.1.

Member Function Documentation

QTabletEvent::QTabletEvent(Type type, constQPoint & pos, constQPoint & globalPos, constQPointF & 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 giventype.

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

pressure contains the pressure exerted on thedevice.

pointerType describes the type of pen that is being used.

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

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

TheuniqueID parameter contains the unique ID for the current device.

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

ThetangentialPressure 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 alsopos(),globalPos(),device(),pressure(),xTilt(),yTilt(),uniqueId(),rotation(),tangentialPressure(), andz().

TabletDevice QTabletEvent::device() const

Returns the type of device that generated the event.

See alsoTabletDevice.

constQPoint & QTabletEvent::globalPos() const

Returns the global position of the deviceat 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 positionQCursor::pos().

See alsoglobalX(),globalY(), andhiResGlobalPos().

int QTabletEvent::globalX() const

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

See alsoglobalY(),globalPos(), andhiResGlobalX().

int QTabletEvent::globalY() const

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

See alsoglobalX(),globalPos(), andhiResGlobalY().

constQPointF & QTabletEvent::hiResGlobalPos() const

The high precision coordinates delivered from the tablet expressed. Sub pixeling information is in the fractional part of theQPointF.

See alsoglobalPos(),hiResGlobalX(), andhiResGlobalY().

qreal QTabletEvent::hiResGlobalX() const

The high precision x position of the tablet device.

qreal QTabletEvent::hiResGlobalY() const

The high precision y position of the tablet device.

PointerType QTabletEvent::pointerType() const

Returns the type of point that generated the event.

constQPoint & QTabletEvent::pos() const

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

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

See alsox(),y(), andglobalPos().

qreal QTabletEvent::pressure() const

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 alsotangentialPressure().

qreal QTabletEvent::rotation() const

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.

qreal QTabletEvent::tangentialPressure() const

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 alsopressure().

qint64 QTabletEvent::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.

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 alsopointerType().

int QTabletEvent::x() const

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

See alsoy() andpos().

int QTabletEvent::xTilt() const

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 alsoyTilt().

int QTabletEvent::y() const

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

See alsox() andpos().

int QTabletEvent::yTilt() const

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 alsoxTilt().

int QTabletEvent::z() const

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 isnot the same as pressure.

See alsopressure().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp