The QTabletEvent 类包含数位板事件的描述参数。 更多...
| 头: | #include <QTabletEvent> |
| 继承: | QInputEvent |
| enum | PointerType { UnknownPointer, Pen, Cursor, Eraser } |
| enum | TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse, RotationStylus } |
| 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 ) | |
| TabletDevice | device () const |
| const QPoint & | globalPos () const |
| int | globalX () const |
| int | globalY () const |
| const QPointF & | hiResGlobalPos () const |
| qreal | hiResGlobalX () const |
| qreal | hiResGlobalY () const |
| PointerType | pointerType () const |
| const QPoint & | pos () 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 |
The QTabletEvent 类包含数位板事件的描述参数。
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 (),和 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 (), xTilt (),和 yTilt (), as well as the type of device being used with device () (见 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 () 若处理数位板事件;否则,它会被发送给父级 Widget。例外情况是 TabletEnterProximity and TabletLeaveProximity events, these are only sent to QApplication and don't check whether or not they are accepted.
The QWidget::setEnabled () 函数可用于启用 (或禁用) 小部件的鼠标事件和键盘事件。
事件处理程序 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.
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.
此枚举定义生成事件是什么点类型。
| 常量 | 值 | 描述 |
|---|---|---|
QTabletEvent::UnknownPointer
|
0
|
未知设备。 |
QTabletEvent::Pen
|
1
|
像手写笔设备的尖端 (笔的窄端)。 |
QTabletEvent::Cursor
|
2
|
任何像游标的设备。 |
QTabletEvent::Eraser
|
3
|
像手写笔设备的橡皮擦端 (笔的宽端)。 |
另请参阅 pointerType ().
此枚举定义生成事件的设备类型。
| 常量 | 值 | 描述 |
|---|---|---|
QTabletEvent::NoDevice
|
0
|
没有设备,或未知设备。 |
QTabletEvent::Puck
|
1
|
游标 (类似扁平鼠标的设备,带有十字准线透明圆圈)。 |
QTabletEvent::Stylus
|
2
|
手写笔。 |
QTabletEvent::Airbrush
|
3
|
喷枪 |
QTabletEvent::FourDMouse
|
4
|
4D 鼠标。 |
QTabletEvent::RotationStylus
|
6
|
特殊手写笔,还知道旋转 (6D 手写笔)。 |
该枚举在 Qt 4.1 引入或被修改。
构造数位板事件为给定 type .
The pos 参数指示事件发生在 Widget 中哪里; globalPos is the corresponding position in absolute coordinates. The hiResGlobalPos contains a high resolution measurement of the position.
pressure 包含的压力施加于 device .
pointerType 描述正在使用的笔类型。
xTilt and yTilt 分别包含设备相对 X 轴和 Y 轴的倾斜度。
keyState 指定按下了哪个键盘修饰符 (如 Ctrl ).
The uniqueID 参数包含当前设备的唯一 ID。
The z 参数包含数位板设备的坐标,这通常由 4D 鼠标滚轮给出。若设备不支持 Z 轴,此处传递 0。
The tangentialPressure 参数包含空气刷的切向压力。若设备不支持切向压力,此处传递 0。
rotation contains the device's rotation in degrees. 4D mice support rotation. If the device does not support rotation, pass 0 here.
另请参阅 pos (), globalPos (), device (), pressure (), xTilt (), yTilt (), uniqueId (), rotation (), tangentialPressure (),和 z ().
返回生成事件的设备类型。
另请参阅 TabletDevice .
返回设备的全局位置 当事件发生时 。这对异步窗口系统 (像 X11) 很重要;每当围绕响应鼠标事件移动 Widget 时,globalPos() 会显著异于当前位置 QCursor::pos ().
另请参阅 globalX (), globalY (),和 hiResGlobalPos ().
返回事件发生时的鼠标指针全局 X 位置。
另请参阅 globalY (), globalPos (),和 hiResGlobalX ().
返回事件发生时数位板设备的全局 y 位置。
另请参阅 globalX (), globalPos (),和 hiResGlobalY ().
交付自数位板表达的高精度坐标。子像素信息按小数部分 QPointF .
另请参阅 globalPos (), hiResGlobalX (),和 hiResGlobalY ().
数位板设备的高精度 X 位置。
数位板设备的高精度 Y 位置。
返回生成事件的点类型。
返回设备位置,相对接收事件 Widget。
若围绕响应鼠标事件移动 Widget,使用 globalPos () 而不是此函数。
另请参阅 x (), y (),和 globalPos ().
返回设备的压力。0.0 指示手写笔不在数位板中,1.0 指示手写笔的最大压力数。
另请参阅 tangentialPressure ().
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.
返回设备的切向压力。这通常由喷枪工具指轮给出。范围是从 -1.0 到 1.0。0.0 指示中立位置。目前喷枪只可以从中立位置向正值方向移动。若设备不支持切向压力,此值始终为 0.0。
另请参阅 pressure ().
返回当前设备的唯一 ID,使之可能区分数位板中同时使用的多个设备。
此特征的支持从属数位板。
同一设备的值可能因操作系统而异。
更高版本的 Linux Wacom 驱动程序现在会报告 ID 信息。若有支持唯一 ID 的数位板且在 Linux 未获取到信息,考虑升级驱动程序。
从 Qt 4.2 起,唯一 ID 相同不管钢笔取向。早期版本会报告不同值,当在某些 OS 使用手写笔的橡皮擦端和钢笔端时。
另请参阅 pointerType ().
返回设备的 x 位置,相对接收事件 Widget。
返回设备 (例如:钢笔) 和 X 轴垂直方向之间的角度。正值朝向数位板物理右侧。角度范围 -60 到 +60 度。
另请参阅 yTilt ().
返回设备的 y 位置,相对接收事件 Widget。
返回设备 (例如:钢笔) 和 Y 轴垂直方向之间的角度。正值朝向数位板底部。角度范围 -60 到 +60 度。
另请参阅 xTilt ().
返回设备的 Z 位置。通常,这由 4D 鼠标滚轮表示。若设备不支持 Z 轴,此值始终为 0。这是 not 如同压力。
另请参阅 pressure ().