summaryrefslogtreecommitdiffstats
path: root/doc/html/qtabletevent.html
blob: f50277b8ecc268b258d05f094dfcce9d3e072fb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qevent.cpp:1900 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QTabletEvent Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QTabletEvent Class Reference</h1>

<p>The QTabletEvent class contains parameters that describe a Tablet
event.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qevent-h.html">qevent.h</a>&gt;</tt>
<p>Inherits <a href="qevent.html">QEvent</a>.
<p><a href="qtabletevent-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn>enum <a href="#TabletDevice-enum"><b>TabletDevice</b></a> { NoDevice = -1, Puck, Stylus, Eraser }</li>
<li class=fn><a href="#QTabletEvent"><b>QTabletEvent</b></a> ( Type&nbsp;t, const&nbsp;QPoint&nbsp;&amp;&nbsp;pos, const&nbsp;QPoint&nbsp;&amp;&nbsp;globalPos, int&nbsp;device, int&nbsp;pressure, int&nbsp;xTilt, int&nbsp;yTilt, const&nbsp;QPair&lt;int,&nbsp;int&gt;&nbsp;&amp;&nbsp;uId )</li>
<li class=fn>QTabletEvent ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pos, const&nbsp;QPoint&nbsp;&amp;&nbsp;globalPos, int&nbsp;device, int&nbsp;pressure, int&nbsp;xTilt, int&nbsp;yTilt, const&nbsp;QPair&lt;int,&nbsp;int&gt;&nbsp;&amp;&nbsp;uId ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>int <a href="#pressure"><b>pressure</b></a> () const</li>
<li class=fn>int <a href="#xTilt"><b>xTilt</b></a> () const</li>
<li class=fn>int <a href="#yTilt"><b>yTilt</b></a> () const</li>
<li class=fn>const QPoint &amp; <a href="#pos"><b>pos</b></a> () const</li>
<li class=fn>const QPoint &amp; <a href="#globalPos"><b>globalPos</b></a> () const</li>
<li class=fn>int <a href="#x"><b>x</b></a> () const</li>
<li class=fn>int <a href="#y"><b>y</b></a> () const</li>
<li class=fn>int <a href="#globalX"><b>globalX</b></a> () const</li>
<li class=fn>int <a href="#globalY"><b>globalY</b></a> () const</li>
<li class=fn>TabletDevice <a href="#device"><b>device</b></a> () const</li>
<li class=fn>int <a href="#isAccepted"><b>isAccepted</b></a> () const</li>
<li class=fn>void <a href="#accept"><b>accept</b></a> ()</li>
<li class=fn>void <a href="#ignore"><b>ignore</b></a> ()</li>
<li class=fn>QPair&lt;int, int&gt; <a href="#uniqueId"><b>uniqueId</b></a> ()</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The QTabletEvent class contains parameters that describe a Tablet
event.
<p> 
<p> Tablet Events are generated from a Wacom&copy; 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 retrieving the position
with <a href="#x">x</a>(), <a href="#y">y</a>(), <a href="#pos">pos</a>(), <a href="#globalX">globalX</a>(), <a href="#globalY">globalY</a>() and <a href="#globalPos">globalPos</a>(). In
some situations you may wish to retrieve the extra information
provided by the tablet device driver, for example, you might want
to adjust color brightness based on pressure. QTabletEvent allows
you to get the <a href="#pressure">pressure</a>(), the <a href="#xTilt">xTilt</a>() and <a href="#yTilt">yTilt</a>(), as well as the
type of device being used with <a href="#device">device</a>() (see <a href="#TabletDevice-enum">TabletDevice</a>).
<p> A tablet event contains a special accept flag that indicates
whether the receiver wants the event. You should call
<a href="#accept">QTabletEvent::accept</a>() if you handle the tablet event; otherwise
it will be sent to the parent widget.
<p> The <a href="qwidget.html#setEnabled">QWidget::setEnabled</a>() function can be used to enable or
disable mouse and keyboard events for a widget.
<p> The event handler <a href="qwidget.html#tabletEvent">QWidget::tabletEvent</a>() receives all three types of tablet
events.  Qt will first send a tabletEvent and 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.
<p> <p>See also <a href="events.html">Event Classes</a>.

<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="TabletDevice-enum"></a>QTabletEvent::TabletDevice</h3>

<p> This enum defines what type of device is generating the event.
<ul>
<li><tt>QTabletEvent::NoDevice</tt> - No device, or an unknown device.
<li><tt>QTabletEvent::Puck</tt> - A Puck (a device that is similar to a flat mouse with
a transparent circle with cross-hairs).
<li><tt>QTabletEvent::Stylus</tt> - A Stylus (the narrow end of the pen).
<li><tt>QTabletEvent::Eraser</tt> - An Eraser (the broad end of the pen).
</ul>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QTabletEvent"></a>QTabletEvent::QTabletEvent ( <a href="qevent.html#Type-enum">Type</a>&nbsp;t, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;globalPos, int&nbsp;device, int&nbsp;pressure, int&nbsp;xTilt, int&nbsp;yTilt, const&nbsp;<a href="qpair.html">QPair</a>&lt;int,&nbsp;int&gt;&nbsp;&amp;&nbsp;uId )
</h3>

Construct a tablet event of type <em>t</em>.  The position of when the event occurred is given
int <em>pos</em> and <em>globalPos</em>.  <em>device</em> contains the <a href="#TabletDevice-enum">device type</a>,
<em>pressure</em> contains the pressure exerted on the <em>device</em>, <em>xTilt</em> and <em>yTilt</em> contain
<em>device</em>'s degree of tilt from the X and Y axis respectively.  The <em>uId</em> contains an
event id.
<p> On Irix, <em>globalPos</em> will contain the high-resolution coordinates received from the
tablet device driver, instead of from the windowing system.
<p> <p>See also <a href="#pos">pos</a>(), <a href="#globalPos">globalPos</a>(), <a href="#device">device</a>(), <a href="#pressure">pressure</a>(), <a href="#xTilt">xTilt</a>(), and <a href="#yTilt">yTilt</a>().

<h3 class=fn><a name="QTabletEvent-2"></a>QTabletEvent::QTabletEvent ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;globalPos, int&nbsp;device, int&nbsp;pressure, int&nbsp;xTilt, int&nbsp;yTilt, const&nbsp;<a href="qpair.html">QPair</a>&lt;int,&nbsp;int&gt;&nbsp;&amp;&nbsp;uId )
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> 
<p> Constructs a tablet event object. The position when the event
occurred is is given in <em>pos</em> and <em>globalPos</em>. <em>device</em>
contains the <a href="#TabletDevice-enum">device type</a>, <em>pressure</em>
contains the pressure exerted on the <em>device</em>, <em>xTilt</em> and <em>yTilt</em> contain the <em>device</em>'s degrees of tilt from the X and Y
axis respectively. The <em>uId</em> contains an event id.
<p> On Irix, <em>globalPos</em> will contain the high-resolution coordinates
received from the tablet device driver, instead of from the
windowing system.
<p> <p>See also <a href="#pos">pos</a>(), <a href="#globalPos">globalPos</a>(), <a href="#device">device</a>(), <a href="#pressure">pressure</a>(), <a href="#xTilt">xTilt</a>(), and <a href="#yTilt">yTilt</a>().

<h3 class=fn>void <a name="accept"></a>QTabletEvent::accept ()
</h3>

<p> Sets the accept flag of the tablet event object.
<p> Setting the accept flag indicates that the receiver of the event
wants the tablet event. Unwanted tablet events are sent to the
parent widget.
<p> The accept flag is set by default.
<p> <p>See also <a href="#ignore">ignore</a>().

<h3 class=fn><a href="qtabletevent.html#TabletDevice-enum">TabletDevice</a> <a name="device"></a>QTabletEvent::device () const
</h3>

<p> Returns the type of device that generated the event. Useful if you
want one end of the pen to do something different than the other.
<p> <p>See also <a href="#TabletDevice-enum">TabletDevice</a>.

<h3 class=fn>const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp; <a name="globalPos"></a>QTabletEvent::globalPos () const
</h3>

<p> Returns the global position of the device <em>at the time of the event</em>. This is important on asynchronous windows systems like X11;
whenever you move your widgets around in response to mouse events,
<a href="#globalPos">globalPos</a>() can differ significantly from the current position
<a href="qcursor.html#pos">QCursor::pos</a>().
<p> <p>See also <a href="#globalX">globalX</a>() and <a href="#globalY">globalY</a>().

<h3 class=fn>int <a name="globalX"></a>QTabletEvent::globalX () const
</h3>

<p> Returns the global x-position of the mouse pointer at the time of
the event.
<p> <p>See also <a href="#globalY">globalY</a>() and <a href="#globalPos">globalPos</a>().

<h3 class=fn>int <a name="globalY"></a>QTabletEvent::globalY () const
</h3>

<p> Returns the global y-position of the mouse pointer at the time of
the event.
<p> <p>See also <a href="#globalX">globalX</a>() and <a href="#globalPos">globalPos</a>().

<h3 class=fn>void <a name="ignore"></a>QTabletEvent::ignore ()
</h3>

<p> Clears the accept flag parameter of the tablet event object.
<p> Clearing the accept flag indicates that the event receiver does
not want the tablet event. Unwanted tablet events are sent to the
parent widget.
<p> The accept flag is set by default.
<p> <p>See also <a href="#accept">accept</a>().

<h3 class=fn>int <a name="isAccepted"></a>QTabletEvent::isAccepted () const
</h3>

<p> Returns TRUE if the receiver of the event handles the tablet
event; otherwise returns FALSE.

<h3 class=fn>const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp; <a name="pos"></a>QTabletEvent::pos () const
</h3>

<p> Returns the position of the device, relative to the widget that
received the event.
<p> If you move widgets around in response to mouse events, use
<a href="#globalPos">globalPos</a>() instead of this function.
<p> <p>See also <a href="#x">x</a>(), <a href="#y">y</a>(), and <a href="#globalPos">globalPos</a>().

<h3 class=fn>int <a name="pressure"></a>QTabletEvent::pressure () const
</h3>

<p> Returns the pressure that is exerted on the device. This number is
a value from 0 (no pressure) to 255 (maximum pressure). The
pressure is always scaled to be within this range no matter how
many pressure levels the underlying hardware supports.

<h3 class=fn><a href="qpair.html">QPair</a>&lt;int,&nbsp;int&gt; <a name="uniqueId"></a>QTabletEvent::uniqueId ()
</h3>

<p> Returns a unique ID for the current device. It is possible to
generate a unique ID for any Wacom&copy; device. This makes it
possible to differentiate between multiple devices being used at
the same time on the tablet. The <tt>first</tt> member contains a value
for the type, the <tt>second</tt> member contains a physical ID obtained
from the device. Each combination of these values is unique. Note:
for different platforms, the <tt>first</tt> value is different due to
different driver implementations.

<h3 class=fn>int <a name="x"></a>QTabletEvent::x () const
</h3>

<p> Returns the x-position of the device, relative to the widget that
received the event.
<p> <p>See also <a href="#y">y</a>() and <a href="#pos">pos</a>().

<h3 class=fn>int <a name="xTilt"></a>QTabletEvent::xTilt () const
</h3>

<p> Returns the difference from the perpendicular in the X Axis.
Positive values are towards the tablet's physical right. The angle
is in the range -60 to +60 degrees.
<p> <p>See also <a href="#yTilt">yTilt</a>().

<h3 class=fn>int <a name="y"></a>QTabletEvent::y () const
</h3>

<p> Returns the y-position of the device, relative to the widget that
received the event.
<p> <p>See also <a href="#x">x</a>() and <a href="#pos">pos</a>().

<h3 class=fn>int <a name="yTilt"></a>QTabletEvent::yTilt () const
</h3>

<p> Returns the difference from the perpendicular in the Y Axis.
Positive values are towards the bottom of the tablet. The angle is
within the range -60 to +60 degrees.
<p> <p>See also <a href="#xTilt">xTilt</a>().

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>