Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qevent.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||||||||
2 | ** | - | ||||||||||||
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||
4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||
5 | ** | - | ||||||||||||
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||||||||
7 | ** | - | ||||||||||||
8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||
9 | ** Commercial License Usage | - | ||||||||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||
14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||
15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||||||||
16 | ** | - | ||||||||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||
19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||||||||
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||
22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||
25 | ** | - | ||||||||||||
26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||
27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||
29 | ** | - | ||||||||||||
30 | ** $QT_END_LICENSE$ | - | ||||||||||||
31 | ** | - | ||||||||||||
32 | ****************************************************************************/ | - | ||||||||||||
33 | - | |||||||||||||
34 | #include "qevent.h" | - | ||||||||||||
35 | #include "qcursor.h" | - | ||||||||||||
36 | #include "private/qguiapplication_p.h" | - | ||||||||||||
37 | #include "qpa/qplatformintegration.h" | - | ||||||||||||
38 | #include "qpa/qplatformdrag.h" | - | ||||||||||||
39 | #include "private/qevent_p.h" | - | ||||||||||||
40 | #include "qmetaobject.h" | - | ||||||||||||
41 | #include "qmimedata.h" | - | ||||||||||||
42 | #include "private/qdnd_p.h" | - | ||||||||||||
43 | #include "qevent_p.h" | - | ||||||||||||
44 | #include "qmath.h" | - | ||||||||||||
45 | - | |||||||||||||
46 | #include <private/qdebug_p.h> | - | ||||||||||||
47 | - | |||||||||||||
48 | QT_BEGIN_NAMESPACE | - | ||||||||||||
49 | - | |||||||||||||
50 | /*! | - | ||||||||||||
51 | \class QEnterEvent | - | ||||||||||||
52 | \ingroup events | - | ||||||||||||
53 | \inmodule QtGui | - | ||||||||||||
54 | - | |||||||||||||
55 | \brief The QEnterEvent class contains parameters that describe an enter event. | - | ||||||||||||
56 | - | |||||||||||||
57 | Enter events occur when the mouse cursor enters a window or a widget. | - | ||||||||||||
58 | - | |||||||||||||
59 | \since 5.0 | - | ||||||||||||
60 | */ | - | ||||||||||||
61 | - | |||||||||||||
62 | /*! | - | ||||||||||||
63 | Constructs an enter event object. | - | ||||||||||||
64 | - | |||||||||||||
65 | The points \a localPos, \a windowPos and \a screenPos specify the | - | ||||||||||||
66 | mouse cursor's position relative to the receiving widget or item, | - | ||||||||||||
67 | window, and screen, respectively. | - | ||||||||||||
68 | */ | - | ||||||||||||
69 | - | |||||||||||||
70 | QEnterEvent::QEnterEvent(const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos) | - | ||||||||||||
71 | : QEvent(QEvent::Enter) | - | ||||||||||||
72 | , l(localPos) | - | ||||||||||||
73 | , w(windowPos) | - | ||||||||||||
74 | , s(screenPos) | - | ||||||||||||
75 | { | - | ||||||||||||
76 | } never executed: end of block | 0 | ||||||||||||
77 | - | |||||||||||||
78 | /*! | - | ||||||||||||
79 | \internal | - | ||||||||||||
80 | */ | - | ||||||||||||
81 | QEnterEvent::~QEnterEvent() | - | ||||||||||||
82 | { | - | ||||||||||||
83 | } | - | ||||||||||||
84 | - | |||||||||||||
85 | /*! | - | ||||||||||||
86 | \fn QPoint QEnterEvent::globalPos() const | - | ||||||||||||
87 | - | |||||||||||||
88 | Returns the global position of the widget \e{at the time of the event}. | - | ||||||||||||
89 | */ | - | ||||||||||||
90 | /*! | - | ||||||||||||
91 | \fn int QEnterEvent::globalX() const | - | ||||||||||||
92 | - | |||||||||||||
93 | Returns the global position on the X-axis of the mouse cursor relative to the the widget. | - | ||||||||||||
94 | */ | - | ||||||||||||
95 | /*! | - | ||||||||||||
96 | \fn int QEnterEvent::globalY() const | - | ||||||||||||
97 | - | |||||||||||||
98 | Returns the global position on the Y-axis of the mouse cursor relative to the the widget. | - | ||||||||||||
99 | */ | - | ||||||||||||
100 | /*! | - | ||||||||||||
101 | \fn QPoint QEnterEvent::localPos() const | - | ||||||||||||
102 | - | |||||||||||||
103 | Returns the mouse cursor's position relative to the receiving widget. | - | ||||||||||||
104 | */ | - | ||||||||||||
105 | /*! | - | ||||||||||||
106 | \fn QPoint QEnterEvent::pos() const | - | ||||||||||||
107 | - | |||||||||||||
108 | Returns the position of the mouse cursor in global screen coordinates. | - | ||||||||||||
109 | */ | - | ||||||||||||
110 | /*! | - | ||||||||||||
111 | \fn QPoint QEnterEvent::screenPos() const | - | ||||||||||||
112 | - | |||||||||||||
113 | Returns the position of the mouse cursor relative to the receiving screen. | - | ||||||||||||
114 | */ | - | ||||||||||||
115 | /*! | - | ||||||||||||
116 | \fn QPoint QEnterEvent::windowPos() const | - | ||||||||||||
117 | - | |||||||||||||
118 | Returns the position of the mouse cursor relative to the receiving window. | - | ||||||||||||
119 | */ | - | ||||||||||||
120 | /*! | - | ||||||||||||
121 | \fn int QEnterEvent::x() const | - | ||||||||||||
122 | - | |||||||||||||
123 | Returns the x position of the mouse cursor relative to the receiving widget. | - | ||||||||||||
124 | */ | - | ||||||||||||
125 | /*! | - | ||||||||||||
126 | \fn int QEnterEvent::y() const | - | ||||||||||||
127 | - | |||||||||||||
128 | Returns the y position of the mouse cursor relative to the receiving widget. | - | ||||||||||||
129 | */ | - | ||||||||||||
130 | - | |||||||||||||
131 | /*! | - | ||||||||||||
132 | \class QInputEvent | - | ||||||||||||
133 | \ingroup events | - | ||||||||||||
134 | \inmodule QtGui | - | ||||||||||||
135 | - | |||||||||||||
136 | \brief The QInputEvent class is the base class for events that | - | ||||||||||||
137 | describe user input. | - | ||||||||||||
138 | */ | - | ||||||||||||
139 | - | |||||||||||||
140 | /*! | - | ||||||||||||
141 | \internal | - | ||||||||||||
142 | */ | - | ||||||||||||
143 | QInputEvent::QInputEvent(Type type, Qt::KeyboardModifiers modifiers) | - | ||||||||||||
144 | : QEvent(type), modState(modifiers), ts(0) | - | ||||||||||||
145 | {} never executed: end of block | 0 | ||||||||||||
146 | - | |||||||||||||
147 | /*! | - | ||||||||||||
148 | \internal | - | ||||||||||||
149 | */ | - | ||||||||||||
150 | QInputEvent::~QInputEvent() | - | ||||||||||||
151 | { | - | ||||||||||||
152 | } | - | ||||||||||||
153 | - | |||||||||||||
154 | /*! | - | ||||||||||||
155 | \fn Qt::KeyboardModifiers QInputEvent::modifiers() const | - | ||||||||||||
156 | - | |||||||||||||
157 | Returns the keyboard modifier flags that existed immediately | - | ||||||||||||
158 | before the event occurred. | - | ||||||||||||
159 | - | |||||||||||||
160 | \sa QGuiApplication::keyboardModifiers() | - | ||||||||||||
161 | */ | - | ||||||||||||
162 | - | |||||||||||||
163 | /*! \fn void QInputEvent::setModifiers(Qt::KeyboardModifiers modifiers) | - | ||||||||||||
164 | - | |||||||||||||
165 | \internal | - | ||||||||||||
166 | - | |||||||||||||
167 | Sets the keyboard modifiers flags for this event. | - | ||||||||||||
168 | */ | - | ||||||||||||
169 | - | |||||||||||||
170 | /*! | - | ||||||||||||
171 | \fn ulong QInputEvent::timestamp() const | - | ||||||||||||
172 | - | |||||||||||||
173 | Returns the window system's timestamp for this event. | - | ||||||||||||
174 | It will normally be in milliseconds since some arbitrary point | - | ||||||||||||
175 | in time, such as the time when the system was started. | - | ||||||||||||
176 | */ | - | ||||||||||||
177 | - | |||||||||||||
178 | /*! \fn void QInputEvent::setTimestamp(ulong atimestamp) | - | ||||||||||||
179 | - | |||||||||||||
180 | \internal | - | ||||||||||||
181 | - | |||||||||||||
182 | Sets the timestamp for this event. | - | ||||||||||||
183 | */ | - | ||||||||||||
184 | - | |||||||||||||
185 | /*! | - | ||||||||||||
186 | \class QMouseEvent | - | ||||||||||||
187 | \ingroup events | - | ||||||||||||
188 | \inmodule QtGui | - | ||||||||||||
189 | - | |||||||||||||
190 | \brief The QMouseEvent class contains parameters that describe a mouse event. | - | ||||||||||||
191 | - | |||||||||||||
192 | Mouse events occur when a mouse button is pressed or released | - | ||||||||||||
193 | inside a widget, or when the mouse cursor is moved. | - | ||||||||||||
194 | - | |||||||||||||
195 | Mouse move events will occur only when a mouse button is pressed | - | ||||||||||||
196 | down, unless mouse tracking has been enabled with | - | ||||||||||||
197 | QWidget::setMouseTracking(). | - | ||||||||||||
198 | - | |||||||||||||
199 | Qt automatically grabs the mouse when a mouse button is pressed | - | ||||||||||||
200 | inside a widget; the widget will continue to receive mouse events | - | ||||||||||||
201 | until the last mouse button is released. | - | ||||||||||||
202 | - | |||||||||||||
203 | A mouse event contains a special accept flag that indicates | - | ||||||||||||
204 | whether the receiver wants the event. You should call ignore() if | - | ||||||||||||
205 | the mouse event is not handled by your widget. A mouse event is | - | ||||||||||||
206 | propagated up the parent widget chain until a widget accepts it | - | ||||||||||||
207 | with accept(), or an event filter consumes it. | - | ||||||||||||
208 | - | |||||||||||||
209 | \note If a mouse event is propagated to a \l{QWidget}{widget} for | - | ||||||||||||
210 | which Qt::WA_NoMousePropagation has been set, that mouse event | - | ||||||||||||
211 | will not be propagated further up the parent widget chain. | - | ||||||||||||
212 | - | |||||||||||||
213 | The state of the keyboard modifier keys can be found by calling the | - | ||||||||||||
214 | \l{QInputEvent::modifiers()}{modifiers()} function, inherited from | - | ||||||||||||
215 | QInputEvent. | - | ||||||||||||
216 | - | |||||||||||||
217 | The functions pos(), x(), and y() give the cursor position | - | ||||||||||||
218 | relative to the widget that receives the mouse event. If you | - | ||||||||||||
219 | move the widget as a result of the mouse event, use the global | - | ||||||||||||
220 | position returned by globalPos() to avoid a shaking motion. | - | ||||||||||||
221 | - | |||||||||||||
222 | The QWidget::setEnabled() function can be used to enable or | - | ||||||||||||
223 | disable mouse and keyboard events for a widget. | - | ||||||||||||
224 | - | |||||||||||||
225 | Reimplement the QWidget event handlers, QWidget::mousePressEvent(), | - | ||||||||||||
226 | QWidget::mouseReleaseEvent(), QWidget::mouseDoubleClickEvent(), | - | ||||||||||||
227 | and QWidget::mouseMoveEvent() to receive mouse events in your own | - | ||||||||||||
228 | widgets. | - | ||||||||||||
229 | - | |||||||||||||
230 | \sa QWidget::setMouseTracking(), QWidget::grabMouse(), | - | ||||||||||||
231 | QCursor::pos() | - | ||||||||||||
232 | */ | - | ||||||||||||
233 | - | |||||||||||||
234 | /*! | - | ||||||||||||
235 | Constructs a mouse event object. | - | ||||||||||||
236 | - | |||||||||||||
237 | The \a type parameter must be one of QEvent::MouseButtonPress, | - | ||||||||||||
238 | QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick, | - | ||||||||||||
239 | or QEvent::MouseMove. | - | ||||||||||||
240 | - | |||||||||||||
241 | The \a localPos is the mouse cursor's position relative to the | - | ||||||||||||
242 | receiving widget or item. The window position is set to the same value | - | ||||||||||||
243 | as \a localPos. | - | ||||||||||||
244 | The \a button that caused the event is given as a value from | - | ||||||||||||
245 | the Qt::MouseButton enum. If the event \a type is | - | ||||||||||||
246 | \l MouseMove, the appropriate button for this event is Qt::NoButton. | - | ||||||||||||
247 | The mouse and keyboard states at the time of the event are specified by | - | ||||||||||||
248 | \a buttons and \a modifiers. | - | ||||||||||||
249 | - | |||||||||||||
250 | The screenPos() is initialized to QCursor::pos(), which may not | - | ||||||||||||
251 | be appropriate. Use the other constructor to specify the global | - | ||||||||||||
252 | position explicitly. | - | ||||||||||||
253 | */ | - | ||||||||||||
254 | QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, Qt::MouseButton button, | - | ||||||||||||
255 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) | - | ||||||||||||
256 | : QInputEvent(type, modifiers), l(localPos), w(localPos), b(button), mouseState(buttons), caps(0) | - | ||||||||||||
257 | { | - | ||||||||||||
258 | #ifndef QT_NO_CURSOR | - | ||||||||||||
259 | s = QCursor::pos(); | - | ||||||||||||
260 | #endif | - | ||||||||||||
261 | } never executed: end of block | 0 | ||||||||||||
262 | - | |||||||||||||
263 | - | |||||||||||||
264 | /*! | - | ||||||||||||
265 | Constructs a mouse event object. | - | ||||||||||||
266 | - | |||||||||||||
267 | The \a type parameter must be QEvent::MouseButtonPress, | - | ||||||||||||
268 | QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick, | - | ||||||||||||
269 | or QEvent::MouseMove. | - | ||||||||||||
270 | - | |||||||||||||
271 | The \a localPos is the mouse cursor's position relative to the | - | ||||||||||||
272 | receiving widget or item. The cursor's position in screen coordinates is | - | ||||||||||||
273 | specified by \a screenPos. The window position is set to the same value | - | ||||||||||||
274 | as \a localPos. The \a button that caused the event is | - | ||||||||||||
275 | given as a value from the \l Qt::MouseButton enum. If the event \a | - | ||||||||||||
276 | type is \l MouseMove, the appropriate button for this event is | - | ||||||||||||
277 | Qt::NoButton. \a buttons is the state of all buttons at the | - | ||||||||||||
278 | time of the event, \a modifiers the state of all keyboard | - | ||||||||||||
279 | modifiers. | - | ||||||||||||
280 | - | |||||||||||||
281 | */ | - | ||||||||||||
282 | QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &screenPos, | - | ||||||||||||
283 | Qt::MouseButton button, Qt::MouseButtons buttons, | - | ||||||||||||
284 | Qt::KeyboardModifiers modifiers) | - | ||||||||||||
285 | : QInputEvent(type, modifiers), l(localPos), w(localPos), s(screenPos), b(button), mouseState(buttons), caps(0) | - | ||||||||||||
286 | {} never executed: end of block | 0 | ||||||||||||
287 | - | |||||||||||||
288 | /*! | - | ||||||||||||
289 | Constructs a mouse event object. | - | ||||||||||||
290 | - | |||||||||||||
291 | The \a type parameter must be QEvent::MouseButtonPress, | - | ||||||||||||
292 | QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick, | - | ||||||||||||
293 | or QEvent::MouseMove. | - | ||||||||||||
294 | - | |||||||||||||
295 | The points \a localPos, \a windowPos and \a screenPos specify the | - | ||||||||||||
296 | mouse cursor's position relative to the receiving widget or item, | - | ||||||||||||
297 | window, and screen, respectively. | - | ||||||||||||
298 | - | |||||||||||||
299 | The \a button that caused the event is | - | ||||||||||||
300 | given as a value from the \l Qt::MouseButton enum. If the event \a | - | ||||||||||||
301 | type is \l MouseMove, the appropriate button for this event is | - | ||||||||||||
302 | Qt::NoButton. \a buttons is the state of all buttons at the | - | ||||||||||||
303 | time of the event, \a modifiers the state of all keyboard | - | ||||||||||||
304 | modifiers. | - | ||||||||||||
305 | - | |||||||||||||
306 | */ | - | ||||||||||||
307 | QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, | - | ||||||||||||
308 | Qt::MouseButton button, Qt::MouseButtons buttons, | - | ||||||||||||
309 | Qt::KeyboardModifiers modifiers) | - | ||||||||||||
310 | : QInputEvent(type, modifiers), l(localPos), w(windowPos), s(screenPos), b(button), mouseState(buttons), caps(0) | - | ||||||||||||
311 | {} never executed: end of block | 0 | ||||||||||||
312 | - | |||||||||||||
313 | /*! | - | ||||||||||||
314 | \since 5.6 | - | ||||||||||||
315 | - | |||||||||||||
316 | Constructs a mouse event object. | - | ||||||||||||
317 | - | |||||||||||||
318 | The \a type parameter must be QEvent::MouseButtonPress, | - | ||||||||||||
319 | QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick, | - | ||||||||||||
320 | or QEvent::MouseMove. | - | ||||||||||||
321 | - | |||||||||||||
322 | The points \a localPos, \a windowPos and \a screenPos specify the | - | ||||||||||||
323 | mouse cursor's position relative to the receiving widget or item, | - | ||||||||||||
324 | window, and screen, respectively. | - | ||||||||||||
325 | - | |||||||||||||
326 | The \a button that caused the event is given as a value from the | - | ||||||||||||
327 | \l Qt::MouseButton enum. If the event \a type is \l MouseMove, | - | ||||||||||||
328 | the appropriate button for this event is Qt::NoButton. \a buttons | - | ||||||||||||
329 | is the state of all buttons at the time of the event, \a modifiers | - | ||||||||||||
330 | is the state of all keyboard modifiers. | - | ||||||||||||
331 | - | |||||||||||||
332 | The source of the event is specified by \a source. | - | ||||||||||||
333 | - | |||||||||||||
334 | */ | - | ||||||||||||
335 | QMouseEvent::QMouseEvent(QEvent::Type type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, | - | ||||||||||||
336 | Qt::MouseButton button, Qt::MouseButtons buttons, | - | ||||||||||||
337 | Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source) | - | ||||||||||||
338 | : QInputEvent(type, modifiers), l(localPos), w(windowPos), s(screenPos), b(button), mouseState(buttons), caps(0) | - | ||||||||||||
339 | { | - | ||||||||||||
340 | QGuiApplicationPrivate::setMouseEventSource(this, source); | - | ||||||||||||
341 | } never executed: end of block | 0 | ||||||||||||
342 | - | |||||||||||||
343 | /*! | - | ||||||||||||
344 | \internal | - | ||||||||||||
345 | */ | - | ||||||||||||
346 | QMouseEvent::~QMouseEvent() | - | ||||||||||||
347 | { | - | ||||||||||||
348 | } | - | ||||||||||||
349 | - | |||||||||||||
350 | /*! | - | ||||||||||||
351 | \since 5.3 | - | ||||||||||||
352 | - | |||||||||||||
353 | Returns information about the mouse event source. | - | ||||||||||||
354 | - | |||||||||||||
355 | The mouse event source can be used to distinguish between genuine | - | ||||||||||||
356 | and artificial mouse events. The latter are events that are | - | ||||||||||||
357 | synthesized from touch events by the operating system or Qt itself. | - | ||||||||||||
358 | - | |||||||||||||
359 | \note Many platforms provide no such information. On such platforms | - | ||||||||||||
360 | \l Qt::MouseEventNotSynthesized is returned always. | - | ||||||||||||
361 | - | |||||||||||||
362 | \sa Qt::MouseEventSource | - | ||||||||||||
363 | \sa QGraphicsSceneMouseEvent::source() | - | ||||||||||||
364 | */ | - | ||||||||||||
365 | Qt::MouseEventSource QMouseEvent::source() const | - | ||||||||||||
366 | { | - | ||||||||||||
367 | return QGuiApplicationPrivate::mouseEventSource(this); never executed: return QGuiApplicationPrivate::mouseEventSource(this); | 0 | ||||||||||||
368 | } | - | ||||||||||||
369 | - | |||||||||||||
370 | /*! | - | ||||||||||||
371 | \since 5.3 | - | ||||||||||||
372 | - | |||||||||||||
373 | Returns the mouse event flags. | - | ||||||||||||
374 | - | |||||||||||||
375 | The mouse event flags provide additional information about a mouse event. | - | ||||||||||||
376 | - | |||||||||||||
377 | \sa Qt::MouseEventFlag | - | ||||||||||||
378 | \sa QGraphicsSceneMouseEvent::flags() | - | ||||||||||||
379 | */ | - | ||||||||||||
380 | Qt::MouseEventFlags QMouseEvent::flags() const | - | ||||||||||||
381 | { | - | ||||||||||||
382 | return QGuiApplicationPrivate::mouseEventFlags(this); never executed: return QGuiApplicationPrivate::mouseEventFlags(this); | 0 | ||||||||||||
383 | } | - | ||||||||||||
384 | - | |||||||||||||
385 | /*! | - | ||||||||||||
386 | \fn QPointF QMouseEvent::localPos() const | - | ||||||||||||
387 | - | |||||||||||||
388 | \since 5.0 | - | ||||||||||||
389 | - | |||||||||||||
390 | Returns the position of the mouse cursor as a QPointF, relative to the | - | ||||||||||||
391 | widget or item that received the event. | - | ||||||||||||
392 | - | |||||||||||||
393 | If you move the widget as a result of the mouse event, use the | - | ||||||||||||
394 | screen position returned by screenPos() to avoid a shaking | - | ||||||||||||
395 | motion. | - | ||||||||||||
396 | - | |||||||||||||
397 | \sa x(), y(), windowPos(), screenPos() | - | ||||||||||||
398 | */ | - | ||||||||||||
399 | - | |||||||||||||
400 | /*! | - | ||||||||||||
401 | \fn QPointF QMouseEvent::windowPos() const | - | ||||||||||||
402 | - | |||||||||||||
403 | \since 5.0 | - | ||||||||||||
404 | - | |||||||||||||
405 | Returns the position of the mouse cursor as a QPointF, relative to the | - | ||||||||||||
406 | window that received the event. | - | ||||||||||||
407 | - | |||||||||||||
408 | If you move the widget as a result of the mouse event, use the | - | ||||||||||||
409 | global position returned by globalPos() to avoid a shaking | - | ||||||||||||
410 | motion. | - | ||||||||||||
411 | - | |||||||||||||
412 | \sa x(), y(), pos(), localPos(), screenPos() | - | ||||||||||||
413 | */ | - | ||||||||||||
414 | - | |||||||||||||
415 | /*! | - | ||||||||||||
416 | \fn QPointF QMouseEvent::screenPos() const | - | ||||||||||||
417 | - | |||||||||||||
418 | \since 5.0 | - | ||||||||||||
419 | - | |||||||||||||
420 | Returns the position of the mouse cursor as a QPointF, relative to the | - | ||||||||||||
421 | screen that received the event. | - | ||||||||||||
422 | - | |||||||||||||
423 | \sa x(), y(), pos(), localPos(), windowPos() | - | ||||||||||||
424 | */ | - | ||||||||||||
425 | - | |||||||||||||
426 | /*! | - | ||||||||||||
427 | \fn QPoint QMouseEvent::pos() const | - | ||||||||||||
428 | - | |||||||||||||
429 | Returns the position of the mouse cursor, relative to the widget | - | ||||||||||||
430 | that received the event. | - | ||||||||||||
431 | - | |||||||||||||
432 | If you move the widget as a result of the mouse event, use the | - | ||||||||||||
433 | global position returned by globalPos() to avoid a shaking | - | ||||||||||||
434 | motion. | - | ||||||||||||
435 | - | |||||||||||||
436 | \sa x(), y(), globalPos() | - | ||||||||||||
437 | */ | - | ||||||||||||
438 | - | |||||||||||||
439 | /*! | - | ||||||||||||
440 | \fn QPoint QMouseEvent::globalPos() const | - | ||||||||||||
441 | - | |||||||||||||
442 | Returns the global position of the mouse cursor \e{at the time | - | ||||||||||||
443 | of the event}. This is important on asynchronous window systems | - | ||||||||||||
444 | like X11. Whenever you move your widgets around in response to | - | ||||||||||||
445 | mouse events, globalPos() may differ a lot from the current | - | ||||||||||||
446 | pointer position QCursor::pos(), and from | - | ||||||||||||
447 | QWidget::mapToGlobal(pos()). | - | ||||||||||||
448 | - | |||||||||||||
449 | \sa globalX(), globalY() | - | ||||||||||||
450 | */ | - | ||||||||||||
451 | - | |||||||||||||
452 | /*! | - | ||||||||||||
453 | \fn int QMouseEvent::x() const | - | ||||||||||||
454 | - | |||||||||||||
455 | Returns the x position of the mouse cursor, relative to the | - | ||||||||||||
456 | widget that received the event. | - | ||||||||||||
457 | - | |||||||||||||
458 | \sa y(), pos() | - | ||||||||||||
459 | */ | - | ||||||||||||
460 | - | |||||||||||||
461 | /*! | - | ||||||||||||
462 | \fn int QMouseEvent::y() const | - | ||||||||||||
463 | - | |||||||||||||
464 | Returns the y position of the mouse cursor, relative to the | - | ||||||||||||
465 | widget that received the event. | - | ||||||||||||
466 | - | |||||||||||||
467 | \sa x(), pos() | - | ||||||||||||
468 | */ | - | ||||||||||||
469 | - | |||||||||||||
470 | /*! | - | ||||||||||||
471 | \fn int QMouseEvent::globalX() const | - | ||||||||||||
472 | - | |||||||||||||
473 | Returns the global x position of the mouse cursor at the time of | - | ||||||||||||
474 | the event. | - | ||||||||||||
475 | - | |||||||||||||
476 | \sa globalY(), globalPos() | - | ||||||||||||
477 | */ | - | ||||||||||||
478 | - | |||||||||||||
479 | /*! | - | ||||||||||||
480 | \fn int QMouseEvent::globalY() const | - | ||||||||||||
481 | - | |||||||||||||
482 | Returns the global y position of the mouse cursor at the time of | - | ||||||||||||
483 | the event. | - | ||||||||||||
484 | - | |||||||||||||
485 | \sa globalX(), globalPos() | - | ||||||||||||
486 | */ | - | ||||||||||||
487 | - | |||||||||||||
488 | /*! | - | ||||||||||||
489 | \fn Qt::MouseButton QMouseEvent::button() const | - | ||||||||||||
490 | - | |||||||||||||
491 | Returns the button that caused the event. | - | ||||||||||||
492 | - | |||||||||||||
493 | Note that the returned value is always Qt::NoButton for mouse | - | ||||||||||||
494 | move events. | - | ||||||||||||
495 | - | |||||||||||||
496 | \sa buttons(), Qt::MouseButton | - | ||||||||||||
497 | */ | - | ||||||||||||
498 | - | |||||||||||||
499 | /*! | - | ||||||||||||
500 | \fn Qt::MouseButton QMouseEvent::buttons() const | - | ||||||||||||
501 | - | |||||||||||||
502 | Returns the button state when the event was generated. The button | - | ||||||||||||
503 | state is a combination of Qt::LeftButton, Qt::RightButton, | - | ||||||||||||
504 | Qt::MidButton using the OR operator. For mouse move events, | - | ||||||||||||
505 | this is all buttons that are pressed down. For mouse press and | - | ||||||||||||
506 | double click events this includes the button that caused the | - | ||||||||||||
507 | event. For mouse release events this excludes the button that | - | ||||||||||||
508 | caused the event. | - | ||||||||||||
509 | - | |||||||||||||
510 | \sa button(), Qt::MouseButton | - | ||||||||||||
511 | */ | - | ||||||||||||
512 | - | |||||||||||||
513 | /*! | - | ||||||||||||
514 | \fn QPointF QMouseEvent::posF() const | - | ||||||||||||
515 | \obsolete | - | ||||||||||||
516 | - | |||||||||||||
517 | Use localPos() instead. | - | ||||||||||||
518 | */ | - | ||||||||||||
519 | - | |||||||||||||
520 | /*! | - | ||||||||||||
521 | \class QHoverEvent | - | ||||||||||||
522 | \ingroup events | - | ||||||||||||
523 | \inmodule QtGui | - | ||||||||||||
524 | - | |||||||||||||
525 | \brief The QHoverEvent class contains parameters that describe a mouse event. | - | ||||||||||||
526 | - | |||||||||||||
527 | Mouse events occur when a mouse cursor is moved into, out of, or within a | - | ||||||||||||
528 | widget, and if the widget has the Qt::WA_Hover attribute. | - | ||||||||||||
529 | - | |||||||||||||
530 | The function pos() gives the current cursor position, while oldPos() gives | - | ||||||||||||
531 | the old mouse position. | - | ||||||||||||
532 | - | |||||||||||||
533 | There are a few similarities between the events QEvent::HoverEnter | - | ||||||||||||
534 | and QEvent::HoverLeave, and the events QEvent::Enter and QEvent::Leave. | - | ||||||||||||
535 | However, they are slightly different because we do an update() in the event | - | ||||||||||||
536 | handler of HoverEnter and HoverLeave. | - | ||||||||||||
537 | - | |||||||||||||
538 | QEvent::HoverMove is also slightly different from QEvent::MouseMove. Let us | - | ||||||||||||
539 | consider a top-level window A containing a child B which in turn contains a | - | ||||||||||||
540 | child C (all with mouse tracking enabled): | - | ||||||||||||
541 | - | |||||||||||||
542 | \image hoverevents.png | - | ||||||||||||
543 | - | |||||||||||||
544 | Now, if you move the cursor from the top to the bottom in the middle of A, | - | ||||||||||||
545 | you will get the following QEvent::MouseMove events: | - | ||||||||||||
546 | - | |||||||||||||
547 | \list 1 | - | ||||||||||||
548 | \li A::MouseMove | - | ||||||||||||
549 | \li B::MouseMove | - | ||||||||||||
550 | \li C::MouseMove | - | ||||||||||||
551 | \endlist | - | ||||||||||||
552 | - | |||||||||||||
553 | You will get the same events for QEvent::HoverMove, except that the event | - | ||||||||||||
554 | always propagates to the top-level regardless whether the event is accepted | - | ||||||||||||
555 | or not. It will only stop propagating with the Qt::WA_NoMousePropagation | - | ||||||||||||
556 | attribute. | - | ||||||||||||
557 | - | |||||||||||||
558 | In this case the events will occur in the following way: | - | ||||||||||||
559 | - | |||||||||||||
560 | \list 1 | - | ||||||||||||
561 | \li A::HoverMove | - | ||||||||||||
562 | \li A::HoverMove, B::HoverMove | - | ||||||||||||
563 | \li A::HoverMove, B::HoverMove, C::HoverMove | - | ||||||||||||
564 | \endlist | - | ||||||||||||
565 | - | |||||||||||||
566 | */ | - | ||||||||||||
567 | - | |||||||||||||
568 | /*! | - | ||||||||||||
569 | \fn QPoint QHoverEvent::pos() const | - | ||||||||||||
570 | - | |||||||||||||
571 | Returns the position of the mouse cursor, relative to the widget | - | ||||||||||||
572 | that received the event. | - | ||||||||||||
573 | - | |||||||||||||
574 | On QEvent::HoverLeave events, this position will always be | - | ||||||||||||
575 | QPoint(-1, -1). | - | ||||||||||||
576 | - | |||||||||||||
577 | \sa oldPos() | - | ||||||||||||
578 | */ | - | ||||||||||||
579 | - | |||||||||||||
580 | /*! | - | ||||||||||||
581 | \fn QPoint QHoverEvent::oldPos() const | - | ||||||||||||
582 | - | |||||||||||||
583 | Returns the previous position of the mouse cursor, relative to the widget | - | ||||||||||||
584 | that received the event. If there is no previous position, oldPos() will | - | ||||||||||||
585 | return the same position as pos(). | - | ||||||||||||
586 | - | |||||||||||||
587 | On QEvent::HoverEnter events, this position will always be | - | ||||||||||||
588 | QPoint(-1, -1). | - | ||||||||||||
589 | - | |||||||||||||
590 | \sa pos() | - | ||||||||||||
591 | */ | - | ||||||||||||
592 | - | |||||||||||||
593 | /*! | - | ||||||||||||
594 | \fn const QPointF &QHoverEvent::posF() const | - | ||||||||||||
595 | - | |||||||||||||
596 | Returns the position of the mouse cursor, relative to the widget | - | ||||||||||||
597 | that received the event. | - | ||||||||||||
598 | - | |||||||||||||
599 | On QEvent::HoverLeave events, this position will always be | - | ||||||||||||
600 | QPointF(-1, -1). | - | ||||||||||||
601 | - | |||||||||||||
602 | \sa oldPosF() | - | ||||||||||||
603 | */ | - | ||||||||||||
604 | - | |||||||||||||
605 | /*! | - | ||||||||||||
606 | \fn const QPointF &QHoverEvent::oldPosF() const | - | ||||||||||||
607 | - | |||||||||||||
608 | Returns the previous position of the mouse cursor, relative to the widget | - | ||||||||||||
609 | that received the event. If there is no previous position, oldPosF() will | - | ||||||||||||
610 | return the same position as posF(). | - | ||||||||||||
611 | - | |||||||||||||
612 | On QEvent::HoverEnter events, this position will always be | - | ||||||||||||
613 | QPointF(-1, -1). | - | ||||||||||||
614 | - | |||||||||||||
615 | \sa posF() | - | ||||||||||||
616 | */ | - | ||||||||||||
617 | - | |||||||||||||
618 | /*! | - | ||||||||||||
619 | Constructs a hover event object. | - | ||||||||||||
620 | - | |||||||||||||
621 | The \a type parameter must be QEvent::HoverEnter, | - | ||||||||||||
622 | QEvent::HoverLeave, or QEvent::HoverMove. | - | ||||||||||||
623 | - | |||||||||||||
624 | The \a pos is the current mouse cursor's position relative to the | - | ||||||||||||
625 | receiving widget, while \a oldPos is its previous such position. | - | ||||||||||||
626 | \a modifiers hold the state of all keyboard modifiers at the time | - | ||||||||||||
627 | of the event. | - | ||||||||||||
628 | */ | - | ||||||||||||
629 | QHoverEvent::QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos, Qt::KeyboardModifiers modifiers) | - | ||||||||||||
630 | : QInputEvent(type, modifiers), p(pos), op(oldPos) | - | ||||||||||||
631 | { | - | ||||||||||||
632 | } never executed: end of block | 0 | ||||||||||||
633 | - | |||||||||||||
634 | /*! | - | ||||||||||||
635 | \internal | - | ||||||||||||
636 | */ | - | ||||||||||||
637 | QHoverEvent::~QHoverEvent() | - | ||||||||||||
638 | { | - | ||||||||||||
639 | } | - | ||||||||||||
640 | - | |||||||||||||
641 | - | |||||||||||||
642 | /*! | - | ||||||||||||
643 | \class QWheelEvent | - | ||||||||||||
644 | \brief The QWheelEvent class contains parameters that describe a wheel event. | - | ||||||||||||
645 | \inmodule QtGui | - | ||||||||||||
646 | - | |||||||||||||
647 | \ingroup events | - | ||||||||||||
648 | - | |||||||||||||
649 | Wheel events are sent to the widget under the mouse cursor, but | - | ||||||||||||
650 | if that widget does not handle the event they are sent to the | - | ||||||||||||
651 | focus widget. Wheel events are generated for both mouse wheels | - | ||||||||||||
652 | and trackpad scroll gestures. There are two ways to read the | - | ||||||||||||
653 | wheel event delta: angleDelta() returns the delta in wheel | - | ||||||||||||
654 | degrees. This value is always provided. pixelDelta() returns | - | ||||||||||||
655 | the delta in screen pixels and is available on platforms that | - | ||||||||||||
656 | have high-resolution trackpads, such as \macos. If that is the | - | ||||||||||||
657 | case, source() will return Qt::MouseEventSynthesizedBySystem. | - | ||||||||||||
658 | - | |||||||||||||
659 | The functions pos() and globalPos() return the mouse cursor's | - | ||||||||||||
660 | location at the time of the event. | - | ||||||||||||
661 | - | |||||||||||||
662 | A wheel event contains a special accept flag that indicates | - | ||||||||||||
663 | whether the receiver wants the event. You should call ignore() if | - | ||||||||||||
664 | you do not handle the wheel event; this ensures that it will be | - | ||||||||||||
665 | sent to the parent widget. | - | ||||||||||||
666 | - | |||||||||||||
667 | The QWidget::setEnabled() function can be used to enable or | - | ||||||||||||
668 | disable mouse and keyboard events for a widget. | - | ||||||||||||
669 | - | |||||||||||||
670 | The event handler QWidget::wheelEvent() receives wheel events. | - | ||||||||||||
671 | - | |||||||||||||
672 | \sa QMouseEvent, QWidget::grabMouse() | - | ||||||||||||
673 | */ | - | ||||||||||||
674 | - | |||||||||||||
675 | /*! | - | ||||||||||||
676 | \fn Qt::MouseButtons QWheelEvent::buttons() const | - | ||||||||||||
677 | - | |||||||||||||
678 | Returns the mouse state when the event occurred. | - | ||||||||||||
679 | */ | - | ||||||||||||
680 | - | |||||||||||||
681 | /*! | - | ||||||||||||
682 | \fn Qt::MouseEventSource QWheelEvent::source() const | - | ||||||||||||
683 | \since 5.5 | - | ||||||||||||
684 | - | |||||||||||||
685 | Returns information about the wheel event source. | - | ||||||||||||
686 | - | |||||||||||||
687 | The source can be used to distinguish between events that come from a mouse | - | ||||||||||||
688 | with a physical wheel and events that are generated by some other means, | - | ||||||||||||
689 | such as a flick gesture on a touchpad. | - | ||||||||||||
690 | - | |||||||||||||
691 | \note Many platforms provide no such information. On such platforms | - | ||||||||||||
692 | \l Qt::MouseEventNotSynthesized is returned always. | - | ||||||||||||
693 | - | |||||||||||||
694 | \sa Qt::MouseEventSource | - | ||||||||||||
695 | */ | - | ||||||||||||
696 | - | |||||||||||||
697 | /*! | - | ||||||||||||
698 | \fn Qt::Orientation QWheelEvent::orientation() const | - | ||||||||||||
699 | \obsolete | - | ||||||||||||
700 | - | |||||||||||||
701 | Returns the wheel's orientation. | - | ||||||||||||
702 | - | |||||||||||||
703 | Use angleDelta() instead. | - | ||||||||||||
704 | */ | - | ||||||||||||
705 | - | |||||||||||||
706 | /*! | - | ||||||||||||
707 | \obsolete | - | ||||||||||||
708 | Constructs a wheel event object. | - | ||||||||||||
709 | - | |||||||||||||
710 | Use the constructor taking \e angleDelta and \e pixelDelta QPoints instead. | - | ||||||||||||
711 | - | |||||||||||||
712 | The position, \a pos, is the location of the mouse cursor within | - | ||||||||||||
713 | the widget. The globalPos() is initialized to QCursor::pos() | - | ||||||||||||
714 | which is usually, but not always, correct. | - | ||||||||||||
715 | Use the other constructor if you need to specify the global | - | ||||||||||||
716 | position explicitly. | - | ||||||||||||
717 | - | |||||||||||||
718 | The \a buttons describe the state of the mouse buttons at the time | - | ||||||||||||
719 | of the event, \a delta contains the rotation distance, | - | ||||||||||||
720 | \a modifiers holds the keyboard modifier flags at the time of the | - | ||||||||||||
721 | event, and \a orient holds the wheel's orientation. | - | ||||||||||||
722 | - | |||||||||||||
723 | \sa pos(), pixelDelta(), angleDelta() | - | ||||||||||||
724 | */ | - | ||||||||||||
725 | #ifndef QT_NO_WHEELEVENT | - | ||||||||||||
726 | QWheelEvent::QWheelEvent(const QPointF &pos, int delta, | - | ||||||||||||
727 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, | - | ||||||||||||
728 | Qt::Orientation orient) | - | ||||||||||||
729 | : QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons), | - | ||||||||||||
730 | ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized) | - | ||||||||||||
731 | { | - | ||||||||||||
732 | if (!QGuiApplicationPrivate::scrollNoPhaseAllowed)
| 0 | ||||||||||||
733 | ph = Qt::ScrollUpdate; never executed: ph = Qt::ScrollUpdate; | 0 | ||||||||||||
734 | g = QCursor::pos(); | - | ||||||||||||
735 | if (orient == Qt::Vertical)
| 0 | ||||||||||||
736 | angleD = QPoint(0, delta); never executed: angleD = QPoint(0, delta); | 0 | ||||||||||||
737 | else | - | ||||||||||||
738 | angleD = QPoint(delta, 0); never executed: angleD = QPoint(delta, 0); | 0 | ||||||||||||
739 | } | - | ||||||||||||
740 | - | |||||||||||||
741 | /*! | - | ||||||||||||
742 | \internal | - | ||||||||||||
743 | */ | - | ||||||||||||
744 | QWheelEvent::~QWheelEvent() | - | ||||||||||||
745 | { | - | ||||||||||||
746 | } | - | ||||||||||||
747 | - | |||||||||||||
748 | /*! | - | ||||||||||||
749 | \obsolete | - | ||||||||||||
750 | Constructs a wheel event object. | - | ||||||||||||
751 | - | |||||||||||||
752 | Use the constructor taking \e angleDelta and \e pixelDelta QPoints instead. | - | ||||||||||||
753 | - | |||||||||||||
754 | The \a pos provides the location of the mouse cursor | - | ||||||||||||
755 | within the widget. The position in global coordinates is specified | - | ||||||||||||
756 | by \a globalPos. \a delta contains the rotation distance, \a modifiers | - | ||||||||||||
757 | holds the keyboard modifier flags at the time of the event, and | - | ||||||||||||
758 | \a orient holds the wheel's orientation. | - | ||||||||||||
759 | - | |||||||||||||
760 | - | |||||||||||||
761 | \sa pos(), pixelDelta(), angleDelta() | - | ||||||||||||
762 | */ | - | ||||||||||||
763 | QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta, | - | ||||||||||||
764 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, | - | ||||||||||||
765 | Qt::Orientation orient) | - | ||||||||||||
766 | : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons), | - | ||||||||||||
767 | ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized) | - | ||||||||||||
768 | { | - | ||||||||||||
769 | if (!QGuiApplicationPrivate::scrollNoPhaseAllowed)
| 0 | ||||||||||||
770 | ph = Qt::ScrollUpdate; never executed: ph = Qt::ScrollUpdate; | 0 | ||||||||||||
771 | if (orient == Qt::Vertical)
| 0 | ||||||||||||
772 | angleD = QPoint(0, delta); never executed: angleD = QPoint(0, delta); | 0 | ||||||||||||
773 | else | - | ||||||||||||
774 | angleD = QPoint(delta, 0); never executed: angleD = QPoint(delta, 0); | 0 | ||||||||||||
775 | } | - | ||||||||||||
776 | - | |||||||||||||
777 | /*! | - | ||||||||||||
778 | Constructs a wheel event object. | - | ||||||||||||
779 | - | |||||||||||||
780 | The \a pos provides the location of the mouse cursor | - | ||||||||||||
781 | within the window. The position in global coordinates is specified | - | ||||||||||||
782 | by \a globalPos. | - | ||||||||||||
783 | - | |||||||||||||
784 | \a pixelDelta contains the scrolling distance in pixels on screen, while | - | ||||||||||||
785 | \a angleDelta contains the wheel rotation distance. \a pixelDelta is | - | ||||||||||||
786 | optional and can be null. | - | ||||||||||||
787 | - | |||||||||||||
788 | The mouse and keyboard states at the time of the event are specified by | - | ||||||||||||
789 | \a buttons and \a modifiers. | - | ||||||||||||
790 | - | |||||||||||||
791 | For backwards compatibility, the event can also hold monodirectional wheel | - | ||||||||||||
792 | event data: \a qt4Delta specifies the rotation, and \a qt4Orientation the | - | ||||||||||||
793 | direction. | - | ||||||||||||
794 | - | |||||||||||||
795 | The phase() is initialized to Qt::ScrollUpdate. Use the other constructor | - | ||||||||||||
796 | to specify the phase explicitly. | - | ||||||||||||
797 | - | |||||||||||||
798 | \sa posF(), globalPosF(), angleDelta(), pixelDelta() | - | ||||||||||||
799 | */ | - | ||||||||||||
800 | - | |||||||||||||
801 | QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, | - | ||||||||||||
802 | QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, | - | ||||||||||||
803 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) | - | ||||||||||||
804 | : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), | - | ||||||||||||
805 | angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(Qt::NoScrollPhase), | - | ||||||||||||
806 | src(Qt::MouseEventNotSynthesized) | - | ||||||||||||
807 | { | - | ||||||||||||
808 | if (!QGuiApplicationPrivate::scrollNoPhaseAllowed)
| 0 | ||||||||||||
809 | ph = Qt::ScrollUpdate; never executed: ph = Qt::ScrollUpdate; | 0 | ||||||||||||
810 | } never executed: end of block | 0 | ||||||||||||
811 | - | |||||||||||||
812 | /*! | - | ||||||||||||
813 | Constructs a wheel event object. | - | ||||||||||||
814 | - | |||||||||||||
815 | The \a pos provides the location of the mouse cursor | - | ||||||||||||
816 | within the window. The position in global coordinates is specified | - | ||||||||||||
817 | by \a globalPos. | - | ||||||||||||
818 | - | |||||||||||||
819 | \a pixelDelta contains the scrolling distance in pixels on screen, while | - | ||||||||||||
820 | \a angleDelta contains the wheel rotation distance. \a pixelDelta is | - | ||||||||||||
821 | optional and can be null. | - | ||||||||||||
822 | - | |||||||||||||
823 | The mouse and keyboard states at the time of the event are specified by | - | ||||||||||||
824 | \a buttons and \a modifiers. | - | ||||||||||||
825 | - | |||||||||||||
826 | For backwards compatibility, the event can also hold monodirectional wheel | - | ||||||||||||
827 | event data: \a qt4Delta specifies the rotation, and \a qt4Orientation the | - | ||||||||||||
828 | direction. | - | ||||||||||||
829 | - | |||||||||||||
830 | The scrolling phase of the event is specified by \a phase. | - | ||||||||||||
831 | - | |||||||||||||
832 | \sa posF(), globalPosF(), angleDelta(), pixelDelta(), phase() | - | ||||||||||||
833 | */ | - | ||||||||||||
834 | - | |||||||||||||
835 | QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, | - | ||||||||||||
836 | QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, | - | ||||||||||||
837 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase) | - | ||||||||||||
838 | : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), | - | ||||||||||||
839 | angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), | - | ||||||||||||
840 | src(Qt::MouseEventNotSynthesized) | - | ||||||||||||
841 | {} never executed: end of block | 0 | ||||||||||||
842 | - | |||||||||||||
843 | /*! | - | ||||||||||||
844 | Constructs a wheel event object. | - | ||||||||||||
845 | - | |||||||||||||
846 | The \a pos provides the location of the mouse cursor | - | ||||||||||||
847 | within the window. The position in global coordinates is specified | - | ||||||||||||
848 | by \a globalPos. | - | ||||||||||||
849 | - | |||||||||||||
850 | \a pixelDelta contains the scrolling distance in pixels on screen, while | - | ||||||||||||
851 | \a angleDelta contains the wheel rotation distance. \a pixelDelta is | - | ||||||||||||
852 | optional and can be null. | - | ||||||||||||
853 | - | |||||||||||||
854 | The mouse and keyboard states at the time of the event are specified by | - | ||||||||||||
855 | \a buttons and \a modifiers. | - | ||||||||||||
856 | - | |||||||||||||
857 | For backwards compatibility, the event can also hold monodirectional wheel | - | ||||||||||||
858 | event data: \a qt4Delta specifies the rotation, and \a qt4Orientation the | - | ||||||||||||
859 | direction. | - | ||||||||||||
860 | - | |||||||||||||
861 | The scrolling phase of the event is specified by \a phase. | - | ||||||||||||
862 | - | |||||||||||||
863 | If the wheel event comes from a physical mouse wheel, \a source is set to | - | ||||||||||||
864 | Qt::MouseEventNotSynthesized. If it comes from a gesture detected by the | - | ||||||||||||
865 | operating system, or from a non-mouse hardware device, such that \a pixelDelta is | - | ||||||||||||
866 | directly related to finger movement, \a source is set to Qt::MouseEventSynthesizedBySystem. | - | ||||||||||||
867 | If it comes from Qt, source would be set to Qt::MouseEventSynthesizedByQt. | - | ||||||||||||
868 | - | |||||||||||||
869 | \sa posF(), globalPosF(), angleDelta(), pixelDelta(), phase() | - | ||||||||||||
870 | */ | - | ||||||||||||
871 | - | |||||||||||||
872 | QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, | - | ||||||||||||
873 | QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, | - | ||||||||||||
874 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source) | - | ||||||||||||
875 | : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), | - | ||||||||||||
876 | angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), src(source) | - | ||||||||||||
877 | {} never executed: end of block | 0 | ||||||||||||
878 | - | |||||||||||||
879 | #endif // QT_NO_WHEELEVENT | - | ||||||||||||
880 | - | |||||||||||||
881 | /*! | - | ||||||||||||
882 | \fn QPoint QWheelEvent::pixelDelta() const | - | ||||||||||||
883 | - | |||||||||||||
884 | Returns the scrolling distance in pixels on screen. This value is | - | ||||||||||||
885 | provided on platforms that support high-resolution pixel-based | - | ||||||||||||
886 | delta values, such as \macos. The value should be used directly | - | ||||||||||||
887 | to scroll content on screen. | - | ||||||||||||
888 | - | |||||||||||||
889 | Example: | - | ||||||||||||
890 | - | |||||||||||||
891 | \snippet code/src_gui_kernel_qevent.cpp 0 | - | ||||||||||||
892 | - | |||||||||||||
893 | \note On platforms that support scrolling \l{phase()}{phases}, the delta may be null when: | - | ||||||||||||
894 | \list | - | ||||||||||||
895 | \li scrolling is about to begin, but the distance did not yet change (Qt::ScrollBegin), | - | ||||||||||||
896 | \li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd). | - | ||||||||||||
897 | \endlist | - | ||||||||||||
898 | */ | - | ||||||||||||
899 | - | |||||||||||||
900 | /*! | - | ||||||||||||
901 | \fn QPoint QWheelEvent::angleDelta() const | - | ||||||||||||
902 | - | |||||||||||||
903 | Returns the distance that the wheel is rotated, in eighths of a | - | ||||||||||||
904 | degree. A positive value indicates that the wheel was rotated | - | ||||||||||||
905 | forwards away from the user; a negative value indicates that the | - | ||||||||||||
906 | wheel was rotated backwards toward the user. | - | ||||||||||||
907 | - | |||||||||||||
908 | Most mouse types work in steps of 15 degrees, in which case the | - | ||||||||||||
909 | delta value is a multiple of 120; i.e., 120 units * 1/8 = 15 degrees. | - | ||||||||||||
910 | - | |||||||||||||
911 | However, some mice have finer-resolution wheels and send delta values | - | ||||||||||||
912 | that are less than 120 units (less than 15 degrees). To support this | - | ||||||||||||
913 | possibility, you can either cumulatively add the delta values from events | - | ||||||||||||
914 | until the value of 120 is reached, then scroll the widget, or you can | - | ||||||||||||
915 | partially scroll the widget in response to each wheel event. | - | ||||||||||||
916 | - | |||||||||||||
917 | Example: | - | ||||||||||||
918 | - | |||||||||||||
919 | \snippet code/src_gui_kernel_qevent.cpp 0 | - | ||||||||||||
920 | - | |||||||||||||
921 | \note On platforms that support scrolling \l{phase()}{phases}, the delta may be null when: | - | ||||||||||||
922 | \list | - | ||||||||||||
923 | \li scrolling is about to begin, but the distance did not yet change (Qt::ScrollBegin), | - | ||||||||||||
924 | \li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd). | - | ||||||||||||
925 | \endlist | - | ||||||||||||
926 | */ | - | ||||||||||||
927 | - | |||||||||||||
928 | /*! | - | ||||||||||||
929 | \fn int QWheelEvent::delta() const | - | ||||||||||||
930 | \obsolete | - | ||||||||||||
931 | - | |||||||||||||
932 | This function has been deprecated, use pixelDelta() or angleDelta() instead. | - | ||||||||||||
933 | */ | - | ||||||||||||
934 | - | |||||||||||||
935 | /*! | - | ||||||||||||
936 | \fn QPoint QWheelEvent::pos() const | - | ||||||||||||
937 | - | |||||||||||||
938 | Returns the position of the mouse cursor relative to the widget | - | ||||||||||||
939 | that received the event. | - | ||||||||||||
940 | - | |||||||||||||
941 | If you move your widgets around in response to mouse events, | - | ||||||||||||
942 | use globalPos() instead of this function. | - | ||||||||||||
943 | - | |||||||||||||
944 | \sa x(), y(), globalPos() | - | ||||||||||||
945 | */ | - | ||||||||||||
946 | - | |||||||||||||
947 | /*! | - | ||||||||||||
948 | \fn int QWheelEvent::x() const | - | ||||||||||||
949 | - | |||||||||||||
950 | Returns the x position of the mouse cursor, relative to the | - | ||||||||||||
951 | widget that received the event. | - | ||||||||||||
952 | - | |||||||||||||
953 | \sa y(), pos() | - | ||||||||||||
954 | */ | - | ||||||||||||
955 | - | |||||||||||||
956 | /*! | - | ||||||||||||
957 | \fn int QWheelEvent::y() const | - | ||||||||||||
958 | - | |||||||||||||
959 | Returns the y position of the mouse cursor, relative to the | - | ||||||||||||
960 | widget that received the event. | - | ||||||||||||
961 | - | |||||||||||||
962 | \sa x(), pos() | - | ||||||||||||
963 | */ | - | ||||||||||||
964 | - | |||||||||||||
965 | - | |||||||||||||
966 | /*! | - | ||||||||||||
967 | \fn QPoint QWheelEvent::globalPos() const | - | ||||||||||||
968 | - | |||||||||||||
969 | Returns the global position of the mouse pointer \e{at the time | - | ||||||||||||
970 | of the event}. This is important on asynchronous window systems | - | ||||||||||||
971 | such as X11; whenever you move your widgets around in response to | - | ||||||||||||
972 | mouse events, globalPos() can differ a lot from the current | - | ||||||||||||
973 | cursor position returned by QCursor::pos(). | - | ||||||||||||
974 | - | |||||||||||||
975 | \sa globalX(), globalY() | - | ||||||||||||
976 | */ | - | ||||||||||||
977 | - | |||||||||||||
978 | /*! | - | ||||||||||||
979 | \fn int QWheelEvent::globalX() const | - | ||||||||||||
980 | - | |||||||||||||
981 | Returns the global x position of the mouse cursor at the time of | - | ||||||||||||
982 | the event. | - | ||||||||||||
983 | - | |||||||||||||
984 | \sa globalY(), globalPos() | - | ||||||||||||
985 | */ | - | ||||||||||||
986 | - | |||||||||||||
987 | /*! | - | ||||||||||||
988 | \fn int QWheelEvent::globalY() const | - | ||||||||||||
989 | - | |||||||||||||
990 | Returns the global y position of the mouse cursor at the time of | - | ||||||||||||
991 | the event. | - | ||||||||||||
992 | - | |||||||||||||
993 | \sa globalX(), globalPos() | - | ||||||||||||
994 | */ | - | ||||||||||||
995 | - | |||||||||||||
996 | /*! | - | ||||||||||||
997 | \fn const QPointF &QWheelEvent::posF() const | - | ||||||||||||
998 | - | |||||||||||||
999 | Returns the position of the mouse cursor relative to the widget | - | ||||||||||||
1000 | that received the event. | - | ||||||||||||
1001 | - | |||||||||||||
1002 | If you move your widgets around in response to mouse events, | - | ||||||||||||
1003 | use globalPosF() instead of this function. | - | ||||||||||||
1004 | - | |||||||||||||
1005 | \sa globalPosF() | - | ||||||||||||
1006 | */ | - | ||||||||||||
1007 | - | |||||||||||||
1008 | /*! | - | ||||||||||||
1009 | \fn const QPointF &QWheelEvent::globalPosF() const | - | ||||||||||||
1010 | - | |||||||||||||
1011 | Returns the global position of the mouse pointer \e{at the time | - | ||||||||||||
1012 | of the event}. This is important on asynchronous window systems | - | ||||||||||||
1013 | such as X11; whenever you move your widgets around in response to | - | ||||||||||||
1014 | mouse events, globalPosF() can differ a lot from the current | - | ||||||||||||
1015 | cursor position returned by QCursor::pos(). | - | ||||||||||||
1016 | - | |||||||||||||
1017 | \sa posF() | - | ||||||||||||
1018 | */ | - | ||||||||||||
1019 | - | |||||||||||||
1020 | /*! | - | ||||||||||||
1021 | \fn Qt::ScrollPhase QWheelEvent::phase() const | - | ||||||||||||
1022 | \since 5.2 | - | ||||||||||||
1023 | - | |||||||||||||
1024 | Returns the scrolling phase of this wheel event. | - | ||||||||||||
1025 | - | |||||||||||||
1026 | \note The Qt::ScrollBegin and Qt::ScrollEnd phases are currently | - | ||||||||||||
1027 | supported only on \macos. | - | ||||||||||||
1028 | */ | - | ||||||||||||
1029 | - | |||||||||||||
1030 | - | |||||||||||||
1031 | /*! | - | ||||||||||||
1032 | \class QKeyEvent | - | ||||||||||||
1033 | \brief The QKeyEvent class describes a key event. | - | ||||||||||||
1034 | - | |||||||||||||
1035 | \ingroup events | - | ||||||||||||
1036 | \inmodule QtGui | - | ||||||||||||
1037 | - | |||||||||||||
1038 | Key events are sent to the widget with keyboard input focus | - | ||||||||||||
1039 | when keys are pressed or released. | - | ||||||||||||
1040 | - | |||||||||||||
1041 | A key event contains a special accept flag that indicates whether | - | ||||||||||||
1042 | the receiver will handle the key event. This flag is set by default | - | ||||||||||||
1043 | for QEvent::KeyPress and QEvent::KeyRelease, so there is no need to | - | ||||||||||||
1044 | call accept() when acting on a key event. For QEvent::ShortcutOverride | - | ||||||||||||
1045 | the receiver needs to explicitly accept the event to trigger the override. | - | ||||||||||||
1046 | Calling ignore() on a key event will propagate it to the parent widget. | - | ||||||||||||
1047 | The event is propagated up the parent widget chain until a widget | - | ||||||||||||
1048 | accepts it or an event filter consumes it. | - | ||||||||||||
1049 | - | |||||||||||||
1050 | The QWidget::setEnable() function can be used to enable or disable | - | ||||||||||||
1051 | mouse and keyboard events for a widget. | - | ||||||||||||
1052 | - | |||||||||||||
1053 | The event handlers QWidget::keyPressEvent(), QWidget::keyReleaseEvent(), | - | ||||||||||||
1054 | QGraphicsItem::keyPressEvent() and QGraphicsItem::keyReleaseEvent() | - | ||||||||||||
1055 | receive key events. | - | ||||||||||||
1056 | - | |||||||||||||
1057 | \sa QFocusEvent, QWidget::grabKeyboard() | - | ||||||||||||
1058 | */ | - | ||||||||||||
1059 | - | |||||||||||||
1060 | /*! | - | ||||||||||||
1061 | Constructs a key event object. | - | ||||||||||||
1062 | - | |||||||||||||
1063 | The \a type parameter must be QEvent::KeyPress, QEvent::KeyRelease, | - | ||||||||||||
1064 | or QEvent::ShortcutOverride. | - | ||||||||||||
1065 | - | |||||||||||||
1066 | Int \a key is the code for the Qt::Key that the event loop should listen | - | ||||||||||||
1067 | for. If \a key is 0, the event is not a result of a known key; for | - | ||||||||||||
1068 | example, it may be the result of a compose sequence or keyboard macro. | - | ||||||||||||
1069 | The \a modifiers holds the keyboard modifiers, and the given \a text | - | ||||||||||||
1070 | is the Unicode text that the key generated. If \a autorep is true, | - | ||||||||||||
1071 | isAutoRepeat() will be true. \a count is the number of keys involved | - | ||||||||||||
1072 | in the event. | - | ||||||||||||
1073 | */ | - | ||||||||||||
1074 | QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text, | - | ||||||||||||
1075 | bool autorep, ushort count) | - | ||||||||||||
1076 | : QInputEvent(type, modifiers), txt(text), k(key), | - | ||||||||||||
1077 | nScanCode(0), nVirtualKey(0), nModifiers(0), | - | ||||||||||||
1078 | c(count), autor(autorep) | - | ||||||||||||
1079 | { | - | ||||||||||||
1080 | if (type == QEvent::ShortcutOverride)
| 0 | ||||||||||||
1081 | ignore(); never executed: ignore(); | 0 | ||||||||||||
1082 | } never executed: end of block | 0 | ||||||||||||
1083 | - | |||||||||||||
1084 | /*! | - | ||||||||||||
1085 | Constructs a key event object. | - | ||||||||||||
1086 | - | |||||||||||||
1087 | The \a type parameter must be QEvent::KeyPress, QEvent::KeyRelease, | - | ||||||||||||
1088 | or QEvent::ShortcutOverride. | - | ||||||||||||
1089 | - | |||||||||||||
1090 | Int \a key is the code for the Qt::Key that the event loop should listen | - | ||||||||||||
1091 | for. If \a key is 0, the event is not a result of a known key; for | - | ||||||||||||
1092 | example, it may be the result of a compose sequence or keyboard macro. | - | ||||||||||||
1093 | The \a modifiers holds the keyboard modifiers, and the given \a text | - | ||||||||||||
1094 | is the Unicode text that the key generated. If \a autorep is true, | - | ||||||||||||
1095 | isAutoRepeat() will be true. \a count is the number of keys involved | - | ||||||||||||
1096 | in the event. | - | ||||||||||||
1097 | - | |||||||||||||
1098 | In addition to the normal key event data, also contains \a nativeScanCode, | - | ||||||||||||
1099 | \a nativeVirtualKey and \a nativeModifiers. This extra data is used by the | - | ||||||||||||
1100 | shortcut system, to determine which shortcuts to trigger. | - | ||||||||||||
1101 | */ | - | ||||||||||||
1102 | QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, | - | ||||||||||||
1103 | quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, | - | ||||||||||||
1104 | const QString &text, bool autorep, ushort count) | - | ||||||||||||
1105 | : QInputEvent(type, modifiers), txt(text), k(key), | - | ||||||||||||
1106 | nScanCode(nativeScanCode), nVirtualKey(nativeVirtualKey), nModifiers(nativeModifiers), | - | ||||||||||||
1107 | c(count), autor(autorep) | - | ||||||||||||
1108 | { | - | ||||||||||||
1109 | if (type == QEvent::ShortcutOverride)
| 0 | ||||||||||||
1110 | ignore(); never executed: ignore(); | 0 | ||||||||||||
1111 | } never executed: end of block | 0 | ||||||||||||
1112 | - | |||||||||||||
1113 | - | |||||||||||||
1114 | /*! | - | ||||||||||||
1115 | \internal | - | ||||||||||||
1116 | */ | - | ||||||||||||
1117 | QKeyEvent::~QKeyEvent() | - | ||||||||||||
1118 | { | - | ||||||||||||
1119 | } | - | ||||||||||||
1120 | - | |||||||||||||
1121 | /*! | - | ||||||||||||
1122 | \fn QKeyEvent *QKeyEvent::createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString& text, bool autorep, ushort count) | - | ||||||||||||
1123 | \internal | - | ||||||||||||
1124 | */ | - | ||||||||||||
1125 | - | |||||||||||||
1126 | /*! | - | ||||||||||||
1127 | \fn bool QKeyEvent::hasExtendedInfo() const | - | ||||||||||||
1128 | \internal | - | ||||||||||||
1129 | */ | - | ||||||||||||
1130 | - | |||||||||||||
1131 | /*! | - | ||||||||||||
1132 | \fn quint32 QKeyEvent::nativeScanCode() const | - | ||||||||||||
1133 | \since 4.2 | - | ||||||||||||
1134 | - | |||||||||||||
1135 | Returns the native scan code of the key event. If the key event | - | ||||||||||||
1136 | does not contain this data 0 is returned. | - | ||||||||||||
1137 | - | |||||||||||||
1138 | Note: The native scan code may be 0, even if the key event contains | - | ||||||||||||
1139 | extended information. | - | ||||||||||||
1140 | - | |||||||||||||
1141 | Note: On Mac OS/X, this function is not useful, because there is no | - | ||||||||||||
1142 | way to get the scan code from Carbon or Cocoa. The function always | - | ||||||||||||
1143 | returns 1 (or 0 in the case explained above). | - | ||||||||||||
1144 | */ | - | ||||||||||||
1145 | - | |||||||||||||
1146 | /*! | - | ||||||||||||
1147 | \fn quint32 QKeyEvent::nativeVirtualKey() const | - | ||||||||||||
1148 | \since 4.2 | - | ||||||||||||
1149 | - | |||||||||||||
1150 | Returns the native virtual key, or key sym of the key event. | - | ||||||||||||
1151 | If the key event does not contain this data 0 is returned. | - | ||||||||||||
1152 | - | |||||||||||||
1153 | Note: The native virtual key may be 0, even if the key event contains extended information. | - | ||||||||||||
1154 | */ | - | ||||||||||||
1155 | - | |||||||||||||
1156 | /*! | - | ||||||||||||
1157 | \fn quint32 QKeyEvent::nativeModifiers() const | - | ||||||||||||
1158 | \since 4.2 | - | ||||||||||||
1159 | - | |||||||||||||
1160 | Returns the native modifiers of a key event. | - | ||||||||||||
1161 | If the key event does not contain this data 0 is returned. | - | ||||||||||||
1162 | - | |||||||||||||
1163 | Note: The native modifiers may be 0, even if the key event contains extended information. | - | ||||||||||||
1164 | */ | - | ||||||||||||
1165 | - | |||||||||||||
1166 | /*! | - | ||||||||||||
1167 | \fn int QKeyEvent::key() const | - | ||||||||||||
1168 | - | |||||||||||||
1169 | Returns the code of the key that was pressed or released. | - | ||||||||||||
1170 | - | |||||||||||||
1171 | See \l Qt::Key for the list of keyboard codes. These codes are | - | ||||||||||||
1172 | independent of the underlying window system. Note that this | - | ||||||||||||
1173 | function does not distinguish between capital and non-capital | - | ||||||||||||
1174 | letters, use the text() function (returning the Unicode text the | - | ||||||||||||
1175 | key generated) for this purpose. | - | ||||||||||||
1176 | - | |||||||||||||
1177 | A value of either 0 or Qt::Key_unknown means that the event is not | - | ||||||||||||
1178 | the result of a known key; for example, it may be the result of | - | ||||||||||||
1179 | a compose sequence, a keyboard macro, or due to key event | - | ||||||||||||
1180 | compression. | - | ||||||||||||
1181 | - | |||||||||||||
1182 | \sa Qt::WA_KeyCompression | - | ||||||||||||
1183 | */ | - | ||||||||||||
1184 | - | |||||||||||||
1185 | /*! | - | ||||||||||||
1186 | \fn QString QKeyEvent::text() const | - | ||||||||||||
1187 | - | |||||||||||||
1188 | Returns the Unicode text that this key generated. | - | ||||||||||||
1189 | - | |||||||||||||
1190 | Return values when modifier keys such as | - | ||||||||||||
1191 | Shift, Control, Alt, and Meta are pressed | - | ||||||||||||
1192 | differ among platforms and could return an empty string. | - | ||||||||||||
1193 | - | |||||||||||||
1194 | \note \l key() will always return a valid value, | - | ||||||||||||
1195 | independent of modifier keys. | - | ||||||||||||
1196 | - | |||||||||||||
1197 | \sa Qt::WA_KeyCompression | - | ||||||||||||
1198 | */ | - | ||||||||||||
1199 | - | |||||||||||||
1200 | /*! | - | ||||||||||||
1201 | Returns the keyboard modifier flags that existed immediately | - | ||||||||||||
1202 | after the event occurred. | - | ||||||||||||
1203 | - | |||||||||||||
1204 | \warning This function cannot always be trusted. The user can | - | ||||||||||||
1205 | confuse it by pressing both \uicontrol{Shift} keys simultaneously and | - | ||||||||||||
1206 | releasing one of them, for example. | - | ||||||||||||
1207 | - | |||||||||||||
1208 | \sa QGuiApplication::keyboardModifiers() | - | ||||||||||||
1209 | */ | - | ||||||||||||
1210 | - | |||||||||||||
1211 | Qt::KeyboardModifiers QKeyEvent::modifiers() const | - | ||||||||||||
1212 | { | - | ||||||||||||
1213 | if (key() == Qt::Key_Shift)
| 0 | ||||||||||||
1214 | return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ShiftModifier); never executed: return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ShiftModifier); | 0 | ||||||||||||
1215 | if (key() == Qt::Key_Control)
| 0 | ||||||||||||
1216 | return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ControlModifier); never executed: return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ControlModifier); | 0 | ||||||||||||
1217 | if (key() == Qt::Key_Alt)
| 0 | ||||||||||||
1218 | return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::AltModifier); never executed: return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::AltModifier); | 0 | ||||||||||||
1219 | if (key() == Qt::Key_Meta)
| 0 | ||||||||||||
1220 | return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::MetaModifier); never executed: return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::MetaModifier); | 0 | ||||||||||||
1221 | if (key() == Qt::Key_AltGr)
| 0 | ||||||||||||
1222 | return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::GroupSwitchModifier); never executed: return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::GroupSwitchModifier); | 0 | ||||||||||||
1223 | return QInputEvent::modifiers(); never executed: return QInputEvent::modifiers(); | 0 | ||||||||||||
1224 | } | - | ||||||||||||
1225 | - | |||||||||||||
1226 | #ifndef QT_NO_SHORTCUT | - | ||||||||||||
1227 | /*! | - | ||||||||||||
1228 | \fn bool QKeyEvent::matches(QKeySequence::StandardKey key) const | - | ||||||||||||
1229 | \since 4.2 | - | ||||||||||||
1230 | - | |||||||||||||
1231 | Returns \c true if the key event matches the given standard \a key; | - | ||||||||||||
1232 | otherwise returns \c false. | - | ||||||||||||
1233 | */ | - | ||||||||||||
1234 | bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const | - | ||||||||||||
1235 | { | - | ||||||||||||
1236 | //The keypad and group switch modifier should not make a difference | - | ||||||||||||
1237 | uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier | Qt::GroupSwitchModifier); | - | ||||||||||||
1238 | - | |||||||||||||
1239 | const QList<QKeySequence> bindings = QKeySequence::keyBindings(matchKey); | - | ||||||||||||
1240 | return bindings.contains(QKeySequence(searchkey)); never executed: return bindings.contains(QKeySequence(searchkey)); | 0 | ||||||||||||
1241 | } | - | ||||||||||||
1242 | #endif // QT_NO_SHORTCUT | - | ||||||||||||
1243 | - | |||||||||||||
1244 | - | |||||||||||||
1245 | /*! | - | ||||||||||||
1246 | \fn bool QKeyEvent::isAutoRepeat() const | - | ||||||||||||
1247 | - | |||||||||||||
1248 | Returns \c true if this event comes from an auto-repeating key; | - | ||||||||||||
1249 | returns \c false if it comes from an initial key press. | - | ||||||||||||
1250 | - | |||||||||||||
1251 | Note that if the event is a multiple-key compressed event that is | - | ||||||||||||
1252 | partly due to auto-repeat, this function could return either true | - | ||||||||||||
1253 | or false indeterminately. | - | ||||||||||||
1254 | */ | - | ||||||||||||
1255 | - | |||||||||||||
1256 | /*! | - | ||||||||||||
1257 | \fn int QKeyEvent::count() const | - | ||||||||||||
1258 | - | |||||||||||||
1259 | Returns the number of keys involved in this event. If text() | - | ||||||||||||
1260 | is not empty, this is simply the length of the string. | - | ||||||||||||
1261 | - | |||||||||||||
1262 | \sa Qt::WA_KeyCompression | - | ||||||||||||
1263 | */ | - | ||||||||||||
1264 | - | |||||||||||||
1265 | /*! | - | ||||||||||||
1266 | \class QFocusEvent | - | ||||||||||||
1267 | \brief The QFocusEvent class contains event parameters for widget focus | - | ||||||||||||
1268 | events. | - | ||||||||||||
1269 | \inmodule QtGui | - | ||||||||||||
1270 | - | |||||||||||||
1271 | \ingroup events | - | ||||||||||||
1272 | - | |||||||||||||
1273 | Focus events are sent to widgets when the keyboard input focus | - | ||||||||||||
1274 | changes. Focus events occur due to mouse actions, key presses | - | ||||||||||||
1275 | (such as \uicontrol{Tab} or \uicontrol{Backtab}), the window system, popup | - | ||||||||||||
1276 | menus, keyboard shortcuts, or other application-specific reasons. | - | ||||||||||||
1277 | The reason for a particular focus event is returned by reason() | - | ||||||||||||
1278 | in the appropriate event handler. | - | ||||||||||||
1279 | - | |||||||||||||
1280 | The event handlers QWidget::focusInEvent(), | - | ||||||||||||
1281 | QWidget::focusOutEvent(), QGraphicsItem::focusInEvent and | - | ||||||||||||
1282 | QGraphicsItem::focusOutEvent() receive focus events. | - | ||||||||||||
1283 | - | |||||||||||||
1284 | \sa QWidget::setFocus(), QWidget::setFocusPolicy(), {Keyboard Focus in Widgets} | - | ||||||||||||
1285 | */ | - | ||||||||||||
1286 | - | |||||||||||||
1287 | /*! | - | ||||||||||||
1288 | Constructs a focus event object. | - | ||||||||||||
1289 | - | |||||||||||||
1290 | The \a type parameter must be either QEvent::FocusIn or | - | ||||||||||||
1291 | QEvent::FocusOut. The \a reason describes the cause of the change | - | ||||||||||||
1292 | in focus. | - | ||||||||||||
1293 | */ | - | ||||||||||||
1294 | QFocusEvent::QFocusEvent(Type type, Qt::FocusReason reason) | - | ||||||||||||
1295 | : QEvent(type), m_reason(reason) | - | ||||||||||||
1296 | {} never executed: end of block | 0 | ||||||||||||
1297 | - | |||||||||||||
1298 | /*! | - | ||||||||||||
1299 | \internal | - | ||||||||||||
1300 | */ | - | ||||||||||||
1301 | QFocusEvent::~QFocusEvent() | - | ||||||||||||
1302 | { | - | ||||||||||||
1303 | } | - | ||||||||||||
1304 | - | |||||||||||||
1305 | /*! | - | ||||||||||||
1306 | Returns the reason for this focus event. | - | ||||||||||||
1307 | */ | - | ||||||||||||
1308 | Qt::FocusReason QFocusEvent::reason() const | - | ||||||||||||
1309 | { | - | ||||||||||||
1310 | return m_reason; never executed: return m_reason; | 0 | ||||||||||||
1311 | } | - | ||||||||||||
1312 | - | |||||||||||||
1313 | /*! | - | ||||||||||||
1314 | \fn bool QFocusEvent::gotFocus() const | - | ||||||||||||
1315 | - | |||||||||||||
1316 | Returns \c true if type() is QEvent::FocusIn; otherwise returns | - | ||||||||||||
1317 | false. | - | ||||||||||||
1318 | */ | - | ||||||||||||
1319 | - | |||||||||||||
1320 | /*! | - | ||||||||||||
1321 | \fn bool QFocusEvent::lostFocus() const | - | ||||||||||||
1322 | - | |||||||||||||
1323 | Returns \c true if type() is QEvent::FocusOut; otherwise returns | - | ||||||||||||
1324 | false. | - | ||||||||||||
1325 | */ | - | ||||||||||||
1326 | - | |||||||||||||
1327 | - | |||||||||||||
1328 | /*! | - | ||||||||||||
1329 | \class QPaintEvent | - | ||||||||||||
1330 | \brief The QPaintEvent class contains event parameters for paint events. | - | ||||||||||||
1331 | \inmodule QtGui | - | ||||||||||||
1332 | - | |||||||||||||
1333 | \ingroup events | - | ||||||||||||
1334 | - | |||||||||||||
1335 | Paint events are sent to widgets that need to update themselves, | - | ||||||||||||
1336 | for instance when part of a widget is exposed because a covering | - | ||||||||||||
1337 | widget was moved. | - | ||||||||||||
1338 | - | |||||||||||||
1339 | The event contains a region() that needs to be updated, and a | - | ||||||||||||
1340 | rect() that is the bounding rectangle of that region. Both are | - | ||||||||||||
1341 | provided because many widgets cannot make much use of region(), | - | ||||||||||||
1342 | and rect() can be much faster than region().boundingRect(). | - | ||||||||||||
1343 | - | |||||||||||||
1344 | \section1 Automatic Clipping | - | ||||||||||||
1345 | - | |||||||||||||
1346 | Painting is clipped to region() during the processing of a paint | - | ||||||||||||
1347 | event. This clipping is performed by Qt's paint system and is | - | ||||||||||||
1348 | independent of any clipping that may be applied to a QPainter used to | - | ||||||||||||
1349 | draw on the paint device. | - | ||||||||||||
1350 | - | |||||||||||||
1351 | As a result, the value returned by QPainter::clipRegion() on | - | ||||||||||||
1352 | a newly-constructed QPainter will not reflect the clip region that is | - | ||||||||||||
1353 | used by the paint system. | - | ||||||||||||
1354 | - | |||||||||||||
1355 | \sa QPainter, QWidget::update(), QWidget::repaint(), | - | ||||||||||||
1356 | QWidget::paintEvent() | - | ||||||||||||
1357 | */ | - | ||||||||||||
1358 | - | |||||||||||||
1359 | /*! | - | ||||||||||||
1360 | Constructs a paint event object with the region that needs to | - | ||||||||||||
1361 | be updated. The region is specified by \a paintRegion. | - | ||||||||||||
1362 | */ | - | ||||||||||||
1363 | QPaintEvent::QPaintEvent(const QRegion& paintRegion) | - | ||||||||||||
1364 | : QEvent(Paint), m_rect(paintRegion.boundingRect()), m_region(paintRegion), m_erased(false) | - | ||||||||||||
1365 | {} never executed: end of block | 0 | ||||||||||||
1366 | - | |||||||||||||
1367 | /*! | - | ||||||||||||
1368 | Constructs a paint event object with the rectangle that needs | - | ||||||||||||
1369 | to be updated. The region is specified by \a paintRect. | - | ||||||||||||
1370 | */ | - | ||||||||||||
1371 | QPaintEvent::QPaintEvent(const QRect &paintRect) | - | ||||||||||||
1372 | : QEvent(Paint), m_rect(paintRect),m_region(paintRect), m_erased(false) | - | ||||||||||||
1373 | {} never executed: end of block | 0 | ||||||||||||
1374 | - | |||||||||||||
1375 | - | |||||||||||||
1376 | /*! | - | ||||||||||||
1377 | \internal | - | ||||||||||||
1378 | */ | - | ||||||||||||
1379 | QPaintEvent::~QPaintEvent() | - | ||||||||||||
1380 | { | - | ||||||||||||
1381 | } | - | ||||||||||||
1382 | - | |||||||||||||
1383 | /*! | - | ||||||||||||
1384 | \fn const QRect &QPaintEvent::rect() const | - | ||||||||||||
1385 | - | |||||||||||||
1386 | Returns the rectangle that needs to be updated. | - | ||||||||||||
1387 | - | |||||||||||||
1388 | \sa region(), QPainter::setClipRect() | - | ||||||||||||
1389 | */ | - | ||||||||||||
1390 | - | |||||||||||||
1391 | /*! | - | ||||||||||||
1392 | \fn const QRegion &QPaintEvent::region() const | - | ||||||||||||
1393 | - | |||||||||||||
1394 | Returns the region that needs to be updated. | - | ||||||||||||
1395 | - | |||||||||||||
1396 | \sa rect(), QPainter::setClipRegion() | - | ||||||||||||
1397 | */ | - | ||||||||||||
1398 | - | |||||||||||||
1399 | - | |||||||||||||
1400 | /*! | - | ||||||||||||
1401 | \class QMoveEvent | - | ||||||||||||
1402 | \brief The QMoveEvent class contains event parameters for move events. | - | ||||||||||||
1403 | \inmodule QtGui | - | ||||||||||||
1404 | - | |||||||||||||
1405 | \ingroup events | - | ||||||||||||
1406 | - | |||||||||||||
1407 | Move events are sent to widgets that have been moved to a new | - | ||||||||||||
1408 | position relative to their parent. | - | ||||||||||||
1409 | - | |||||||||||||
1410 | The event handler QWidget::moveEvent() receives move events. | - | ||||||||||||
1411 | - | |||||||||||||
1412 | \sa QWidget::move(), QWidget::setGeometry() | - | ||||||||||||
1413 | */ | - | ||||||||||||
1414 | - | |||||||||||||
1415 | /*! | - | ||||||||||||
1416 | Constructs a move event with the new and old widget positions, | - | ||||||||||||
1417 | \a pos and \a oldPos respectively. | - | ||||||||||||
1418 | */ | - | ||||||||||||
1419 | QMoveEvent::QMoveEvent(const QPoint &pos, const QPoint &oldPos) | - | ||||||||||||
1420 | : QEvent(Move), p(pos), oldp(oldPos) | - | ||||||||||||
1421 | {} never executed: end of block | 0 | ||||||||||||
1422 | - | |||||||||||||
1423 | /*! | - | ||||||||||||
1424 | \internal | - | ||||||||||||
1425 | */ | - | ||||||||||||
1426 | QMoveEvent::~QMoveEvent() | - | ||||||||||||
1427 | { | - | ||||||||||||
1428 | } | - | ||||||||||||
1429 | - | |||||||||||||
1430 | /*! | - | ||||||||||||
1431 | \fn const QPoint &QMoveEvent::pos() const | - | ||||||||||||
1432 | - | |||||||||||||
1433 | Returns the new position of the widget. This excludes the window | - | ||||||||||||
1434 | frame for top level widgets. | - | ||||||||||||
1435 | */ | - | ||||||||||||
1436 | - | |||||||||||||
1437 | /*! | - | ||||||||||||
1438 | \fn const QPoint &QMoveEvent::oldPos() const | - | ||||||||||||
1439 | - | |||||||||||||
1440 | Returns the old position of the widget. | - | ||||||||||||
1441 | */ | - | ||||||||||||
1442 | - | |||||||||||||
1443 | /*! | - | ||||||||||||
1444 | \class QExposeEvent | - | ||||||||||||
1445 | \since 5.0 | - | ||||||||||||
1446 | \brief The QExposeEvent class contains event parameters for expose events. | - | ||||||||||||
1447 | \inmodule QtGui | - | ||||||||||||
1448 | - | |||||||||||||
1449 | \ingroup events | - | ||||||||||||
1450 | - | |||||||||||||
1451 | Expose events are sent to windows when an area of the window is invalidated | - | ||||||||||||
1452 | or window visibility in the windowing system changes. | - | ||||||||||||
1453 | - | |||||||||||||
1454 | The event handler QWindow::exposeEvent() receives expose events. | - | ||||||||||||
1455 | */ | - | ||||||||||||
1456 | - | |||||||||||||
1457 | /*! | - | ||||||||||||
1458 | Constructs an expose event for the given \a exposeRegion which must be | - | ||||||||||||
1459 | in local coordinates. | - | ||||||||||||
1460 | */ | - | ||||||||||||
1461 | QExposeEvent::QExposeEvent(const QRegion &exposeRegion) | - | ||||||||||||
1462 | : QEvent(Expose) | - | ||||||||||||
1463 | , rgn(exposeRegion) | - | ||||||||||||
1464 | { | - | ||||||||||||
1465 | } never executed: end of block | 0 | ||||||||||||
1466 | - | |||||||||||||
1467 | /*! | - | ||||||||||||
1468 | \internal | - | ||||||||||||
1469 | */ | - | ||||||||||||
1470 | QExposeEvent::~QExposeEvent() | - | ||||||||||||
1471 | { | - | ||||||||||||
1472 | } | - | ||||||||||||
1473 | - | |||||||||||||
1474 | /*! | - | ||||||||||||
1475 | \class QPlatformSurfaceEvent | - | ||||||||||||
1476 | \since 5.5 | - | ||||||||||||
1477 | \brief The QPlatformSurfaceEvent class is used to notify about native platform surface events. | - | ||||||||||||
1478 | \inmodule QtGui | - | ||||||||||||
1479 | - | |||||||||||||
1480 | \ingroup events | - | ||||||||||||
1481 | - | |||||||||||||
1482 | Platform window events are synchronously sent to windows and offscreen surfaces when their | - | ||||||||||||
1483 | underlying native surfaces are created or are about to be destroyed. | - | ||||||||||||
1484 | - | |||||||||||||
1485 | Applications can respond to these events to know when the underlying platform | - | ||||||||||||
1486 | surface exists. | - | ||||||||||||
1487 | */ | - | ||||||||||||
1488 | - | |||||||||||||
1489 | /*! | - | ||||||||||||
1490 | \enum QPlatformSurfaceEvent::SurfaceEventType | - | ||||||||||||
1491 | - | |||||||||||||
1492 | This enum describes the type of platform surface event. The possible types are: | - | ||||||||||||
1493 | - | |||||||||||||
1494 | \value SurfaceCreated The underlying native surface has been created | - | ||||||||||||
1495 | \value SurfaceAboutToBeDestroyed The underlying native surface will be destroyed immediately after this event | - | ||||||||||||
1496 | - | |||||||||||||
1497 | The \c SurfaceAboutToBeDestroyed event type is useful as a means of stopping rendering to | - | ||||||||||||
1498 | a platform window before it is destroyed. | - | ||||||||||||
1499 | */ | - | ||||||||||||
1500 | - | |||||||||||||
1501 | /*! | - | ||||||||||||
1502 | \fn QPlatformSurfaceEvent::SurfaceEventType QPlatformSurfaceEvent::surfaceEventType() const | - | ||||||||||||
1503 | - | |||||||||||||
1504 | Returns the specific type of platform surface event. | - | ||||||||||||
1505 | */ | - | ||||||||||||
1506 | - | |||||||||||||
1507 | /*! | - | ||||||||||||
1508 | Constructs a platform surface event for the given \a surfaceEventType. | - | ||||||||||||
1509 | */ | - | ||||||||||||
1510 | QPlatformSurfaceEvent::QPlatformSurfaceEvent(SurfaceEventType surfaceEventType) | - | ||||||||||||
1511 | : QEvent(PlatformSurface) | - | ||||||||||||
1512 | , m_surfaceEventType(surfaceEventType) | - | ||||||||||||
1513 | { | - | ||||||||||||
1514 | } never executed: end of block | 0 | ||||||||||||
1515 | - | |||||||||||||
1516 | /*! | - | ||||||||||||
1517 | \internal | - | ||||||||||||
1518 | */ | - | ||||||||||||
1519 | QPlatformSurfaceEvent::~QPlatformSurfaceEvent() | - | ||||||||||||
1520 | { | - | ||||||||||||
1521 | } | - | ||||||||||||
1522 | - | |||||||||||||
1523 | /*! | - | ||||||||||||
1524 | \fn const QRegion &QExposeEvent::region() const | - | ||||||||||||
1525 | - | |||||||||||||
1526 | Returns the window area that has been exposed. The region is given in local coordinates. | - | ||||||||||||
1527 | */ | - | ||||||||||||
1528 | - | |||||||||||||
1529 | /*! | - | ||||||||||||
1530 | \class QResizeEvent | - | ||||||||||||
1531 | \brief The QResizeEvent class contains event parameters for resize events. | - | ||||||||||||
1532 | \inmodule QtGui | - | ||||||||||||
1533 | - | |||||||||||||
1534 | \ingroup events | - | ||||||||||||
1535 | - | |||||||||||||
1536 | Resize events are sent to widgets that have been resized. | - | ||||||||||||
1537 | - | |||||||||||||
1538 | The event handler QWidget::resizeEvent() receives resize events. | - | ||||||||||||
1539 | - | |||||||||||||
1540 | \sa QWidget::resize(), QWidget::setGeometry() | - | ||||||||||||
1541 | */ | - | ||||||||||||
1542 | - | |||||||||||||
1543 | /*! | - | ||||||||||||
1544 | Constructs a resize event with the new and old widget sizes, \a | - | ||||||||||||
1545 | size and \a oldSize respectively. | - | ||||||||||||
1546 | */ | - | ||||||||||||
1547 | QResizeEvent::QResizeEvent(const QSize &size, const QSize &oldSize) | - | ||||||||||||
1548 | : QEvent(Resize), s(size), olds(oldSize) | - | ||||||||||||
1549 | {} never executed: end of block | 0 | ||||||||||||
1550 | - | |||||||||||||
1551 | /*! | - | ||||||||||||
1552 | \internal | - | ||||||||||||
1553 | */ | - | ||||||||||||
1554 | QResizeEvent::~QResizeEvent() | - | ||||||||||||
1555 | { | - | ||||||||||||
1556 | } | - | ||||||||||||
1557 | - | |||||||||||||
1558 | /*! | - | ||||||||||||
1559 | \fn const QSize &QResizeEvent::size() const | - | ||||||||||||
1560 | - | |||||||||||||
1561 | Returns the new size of the widget. This is the same as | - | ||||||||||||
1562 | QWidget::size(). | - | ||||||||||||
1563 | */ | - | ||||||||||||
1564 | - | |||||||||||||
1565 | /*! | - | ||||||||||||
1566 | \fn const QSize &QResizeEvent::oldSize() const | - | ||||||||||||
1567 | - | |||||||||||||
1568 | Returns the old size of the widget. | - | ||||||||||||
1569 | */ | - | ||||||||||||
1570 | - | |||||||||||||
1571 | - | |||||||||||||
1572 | /*! | - | ||||||||||||
1573 | \class QCloseEvent | - | ||||||||||||
1574 | \brief The QCloseEvent class contains parameters that describe a close event. | - | ||||||||||||
1575 | - | |||||||||||||
1576 | \ingroup events | - | ||||||||||||
1577 | \inmodule QtGui | - | ||||||||||||
1578 | - | |||||||||||||
1579 | Close events are sent to widgets that the user wants to close, | - | ||||||||||||
1580 | usually by choosing "Close" from the window menu, or by clicking | - | ||||||||||||
1581 | the \uicontrol{X} title bar button. They are also sent when you call | - | ||||||||||||
1582 | QWidget::close() to close a widget programmatically. | - | ||||||||||||
1583 | - | |||||||||||||
1584 | Close events contain a flag that indicates whether the receiver | - | ||||||||||||
1585 | wants the widget to be closed or not. When a widget accepts the | - | ||||||||||||
1586 | close event, it is hidden (and destroyed if it was created with | - | ||||||||||||
1587 | the Qt::WA_DeleteOnClose flag). If it refuses to accept the close | - | ||||||||||||
1588 | event nothing happens. (Under X11 it is possible that the window | - | ||||||||||||
1589 | manager will forcibly close the window; but at the time of writing | - | ||||||||||||
1590 | we are not aware of any window manager that does this.) | - | ||||||||||||
1591 | - | |||||||||||||
1592 | The event handler QWidget::closeEvent() receives close events. The | - | ||||||||||||
1593 | default implementation of this event handler accepts the close | - | ||||||||||||
1594 | event. If you do not want your widget to be hidden, or want some | - | ||||||||||||
1595 | special handling, you should reimplement the event handler and | - | ||||||||||||
1596 | ignore() the event. | - | ||||||||||||
1597 | - | |||||||||||||
1598 | The \l{mainwindows/application#close event handler}{closeEvent() in the | - | ||||||||||||
1599 | Application example} shows a close event handler that | - | ||||||||||||
1600 | asks whether to save a document before closing. | - | ||||||||||||
1601 | - | |||||||||||||
1602 | If you want the widget to be deleted when it is closed, create it | - | ||||||||||||
1603 | with the Qt::WA_DeleteOnClose flag. This is very useful for | - | ||||||||||||
1604 | independent top-level windows in a multi-window application. | - | ||||||||||||
1605 | - | |||||||||||||
1606 | \l{QObject}s emits the \l{QObject::destroyed()}{destroyed()} | - | ||||||||||||
1607 | signal when they are deleted. | - | ||||||||||||
1608 | - | |||||||||||||
1609 | If the last top-level window is closed, the | - | ||||||||||||
1610 | QGuiApplication::lastWindowClosed() signal is emitted. | - | ||||||||||||
1611 | - | |||||||||||||
1612 | The isAccepted() function returns \c true if the event's receiver has | - | ||||||||||||
1613 | agreed to close the widget; call accept() to agree to close the | - | ||||||||||||
1614 | widget and call ignore() if the receiver of this event does not | - | ||||||||||||
1615 | want the widget to be closed. | - | ||||||||||||
1616 | - | |||||||||||||
1617 | \sa QWidget::close(), QWidget::hide(), QObject::destroyed(), | - | ||||||||||||
1618 | QCoreApplication::exec(), QCoreApplication::quit(), | - | ||||||||||||
1619 | QGuiApplication::lastWindowClosed() | - | ||||||||||||
1620 | */ | - | ||||||||||||
1621 | - | |||||||||||||
1622 | /*! | - | ||||||||||||
1623 | Constructs a close event object. | - | ||||||||||||
1624 | - | |||||||||||||
1625 | \sa accept() | - | ||||||||||||
1626 | */ | - | ||||||||||||
1627 | QCloseEvent::QCloseEvent() | - | ||||||||||||
1628 | : QEvent(Close) | - | ||||||||||||
1629 | {} never executed: end of block | 0 | ||||||||||||
1630 | - | |||||||||||||
1631 | /*! \internal | - | ||||||||||||
1632 | */ | - | ||||||||||||
1633 | QCloseEvent::~QCloseEvent() | - | ||||||||||||
1634 | { | - | ||||||||||||
1635 | } | - | ||||||||||||
1636 | - | |||||||||||||
1637 | /*! | - | ||||||||||||
1638 | \class QIconDragEvent | - | ||||||||||||
1639 | \brief The QIconDragEvent class indicates that a main icon drag has begun. | - | ||||||||||||
1640 | \inmodule QtGui | - | ||||||||||||
1641 | - | |||||||||||||
1642 | \ingroup events | - | ||||||||||||
1643 | - | |||||||||||||
1644 | Icon drag events are sent to widgets when the main icon of a window | - | ||||||||||||
1645 | has been dragged away. On \macos, this happens when the proxy | - | ||||||||||||
1646 | icon of a window is dragged off the title bar. | - | ||||||||||||
1647 | - | |||||||||||||
1648 | It is normal to begin using drag and drop in response to this | - | ||||||||||||
1649 | event. | - | ||||||||||||
1650 | - | |||||||||||||
1651 | \sa {Drag and Drop}, QMimeData, QDrag | - | ||||||||||||
1652 | */ | - | ||||||||||||
1653 | - | |||||||||||||
1654 | /*! | - | ||||||||||||
1655 | Constructs an icon drag event object with the accept flag set to | - | ||||||||||||
1656 | false. | - | ||||||||||||
1657 | - | |||||||||||||
1658 | \sa accept() | - | ||||||||||||
1659 | */ | - | ||||||||||||
1660 | QIconDragEvent::QIconDragEvent() | - | ||||||||||||
1661 | : QEvent(IconDrag) | - | ||||||||||||
1662 | { never executed: ignore(); }end of block never executed: end of block | 0 | ||||||||||||
1663 | - | |||||||||||||
1664 | /*! \internal */ | - | ||||||||||||
1665 | QIconDragEvent::~QIconDragEvent() | - | ||||||||||||
1666 | { | - | ||||||||||||
1667 | } | - | ||||||||||||
1668 | - | |||||||||||||
1669 | /*! | - | ||||||||||||
1670 | \class QContextMenuEvent | - | ||||||||||||
1671 | \brief The QContextMenuEvent class contains parameters that describe a context menu event. | - | ||||||||||||
1672 | \inmodule QtGui | - | ||||||||||||
1673 | - | |||||||||||||
1674 | \ingroup events | - | ||||||||||||
1675 | - | |||||||||||||
1676 | Context menu events are sent to widgets when a user performs | - | ||||||||||||
1677 | an action associated with opening a context menu. | - | ||||||||||||
1678 | The actions required to open context menus vary between platforms; | - | ||||||||||||
1679 | for example, on Windows, pressing the menu button or clicking the | - | ||||||||||||
1680 | right mouse button will cause this event to be sent. | - | ||||||||||||
1681 | - | |||||||||||||
1682 | When this event occurs it is customary to show a QMenu with a | - | ||||||||||||
1683 | context menu, if this is relevant to the context. | - | ||||||||||||
1684 | - | |||||||||||||
1685 | Context menu events contain a special accept flag that indicates | - | ||||||||||||
1686 | whether the receiver accepted the event. If the event handler does | - | ||||||||||||
1687 | not accept the event then, if possible, whatever triggered the event will be | - | ||||||||||||
1688 | handled as a regular input event. | - | ||||||||||||
1689 | */ | - | ||||||||||||
1690 | - | |||||||||||||
1691 | #ifndef QT_NO_CONTEXTMENU | - | ||||||||||||
1692 | /*! | - | ||||||||||||
1693 | Constructs a context menu event object with the accept parameter | - | ||||||||||||
1694 | flag set to false. | - | ||||||||||||
1695 | - | |||||||||||||
1696 | The \a reason parameter must be QContextMenuEvent::Mouse or | - | ||||||||||||
1697 | QContextMenuEvent::Keyboard. | - | ||||||||||||
1698 | - | |||||||||||||
1699 | The \a pos parameter specifies the mouse position relative to the | - | ||||||||||||
1700 | receiving widget. \a globalPos is the mouse position in absolute | - | ||||||||||||
1701 | coordinates. | - | ||||||||||||
1702 | */ | - | ||||||||||||
1703 | QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos) | - | ||||||||||||
1704 | : QInputEvent(ContextMenu), p(pos), gp(globalPos), reas(reason) | - | ||||||||||||
1705 | {} never executed: end of block | 0 | ||||||||||||
1706 | - | |||||||||||||
1707 | /*! | - | ||||||||||||
1708 | Constructs a context menu event object with the accept parameter | - | ||||||||||||
1709 | flag set to false. | - | ||||||||||||
1710 | - | |||||||||||||
1711 | The \a reason parameter must be QContextMenuEvent::Mouse or | - | ||||||||||||
1712 | QContextMenuEvent::Keyboard. | - | ||||||||||||
1713 | - | |||||||||||||
1714 | The \a pos parameter specifies the mouse position relative to the | - | ||||||||||||
1715 | receiving widget. \a globalPos is the mouse position in absolute | - | ||||||||||||
1716 | coordinates. The \a modifiers holds the keyboard modifiers. | - | ||||||||||||
1717 | */ | - | ||||||||||||
1718 | QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos, | - | ||||||||||||
1719 | Qt::KeyboardModifiers modifiers) | - | ||||||||||||
1720 | : QInputEvent(ContextMenu, modifiers), p(pos), gp(globalPos), reas(reason) | - | ||||||||||||
1721 | {} never executed: end of block | 0 | ||||||||||||
1722 | - | |||||||||||||
1723 | - | |||||||||||||
1724 | /*! \internal */ | - | ||||||||||||
1725 | QContextMenuEvent::~QContextMenuEvent() | - | ||||||||||||
1726 | { | - | ||||||||||||
1727 | } | - | ||||||||||||
1728 | /*! | - | ||||||||||||
1729 | Constructs a context menu event object with the accept parameter | - | ||||||||||||
1730 | flag set to false. | - | ||||||||||||
1731 | - | |||||||||||||
1732 | The \a reason parameter must be QContextMenuEvent::Mouse or | - | ||||||||||||
1733 | QContextMenuEvent::Keyboard. | - | ||||||||||||
1734 | - | |||||||||||||
1735 | The \a pos parameter specifies the mouse position relative to the | - | ||||||||||||
1736 | receiving widget. | - | ||||||||||||
1737 | - | |||||||||||||
1738 | The globalPos() is initialized to QCursor::pos(), which may not be | - | ||||||||||||
1739 | appropriate. Use the other constructor to specify the global | - | ||||||||||||
1740 | position explicitly. | - | ||||||||||||
1741 | */ | - | ||||||||||||
1742 | QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos) | - | ||||||||||||
1743 | : QInputEvent(ContextMenu), p(pos), reas(reason) | - | ||||||||||||
1744 | { | - | ||||||||||||
1745 | #ifndef QT_NO_CURSOR | - | ||||||||||||
1746 | gp = QCursor::pos(); | - | ||||||||||||
1747 | #endif | - | ||||||||||||
1748 | } never executed: end of block | 0 | ||||||||||||
1749 | - | |||||||||||||
1750 | /*! | - | ||||||||||||
1751 | \fn const QPoint &QContextMenuEvent::pos() const | - | ||||||||||||
1752 | - | |||||||||||||
1753 | Returns the position of the mouse pointer relative to the widget | - | ||||||||||||
1754 | that received the event. | - | ||||||||||||
1755 | - | |||||||||||||
1756 | \sa x(), y(), globalPos() | - | ||||||||||||
1757 | */ | - | ||||||||||||
1758 | - | |||||||||||||
1759 | /*! | - | ||||||||||||
1760 | \fn int QContextMenuEvent::x() const | - | ||||||||||||
1761 | - | |||||||||||||
1762 | Returns the x position of the mouse pointer, relative to the | - | ||||||||||||
1763 | widget that received the event. | - | ||||||||||||
1764 | - | |||||||||||||
1765 | \sa y(), pos() | - | ||||||||||||
1766 | */ | - | ||||||||||||
1767 | - | |||||||||||||
1768 | /*! | - | ||||||||||||
1769 | \fn int QContextMenuEvent::y() const | - | ||||||||||||
1770 | - | |||||||||||||
1771 | Returns the y position of the mouse pointer, relative to the | - | ||||||||||||
1772 | widget that received the event. | - | ||||||||||||
1773 | - | |||||||||||||
1774 | \sa x(), pos() | - | ||||||||||||
1775 | */ | - | ||||||||||||
1776 | - | |||||||||||||
1777 | /*! | - | ||||||||||||
1778 | \fn const QPoint &QContextMenuEvent::globalPos() const | - | ||||||||||||
1779 | - | |||||||||||||
1780 | Returns the global position of the mouse pointer at the time of | - | ||||||||||||
1781 | the event. | - | ||||||||||||
1782 | - | |||||||||||||
1783 | \sa x(), y(), pos() | - | ||||||||||||
1784 | */ | - | ||||||||||||
1785 | - | |||||||||||||
1786 | /*! | - | ||||||||||||
1787 | \fn int QContextMenuEvent::globalX() const | - | ||||||||||||
1788 | - | |||||||||||||
1789 | Returns the global x position of the mouse pointer at the time of | - | ||||||||||||
1790 | the event. | - | ||||||||||||
1791 | - | |||||||||||||
1792 | \sa globalY(), globalPos() | - | ||||||||||||
1793 | */ | - | ||||||||||||
1794 | - | |||||||||||||
1795 | /*! | - | ||||||||||||
1796 | \fn int QContextMenuEvent::globalY() const | - | ||||||||||||
1797 | - | |||||||||||||
1798 | Returns the global y position of the mouse pointer at the time of | - | ||||||||||||
1799 | the event. | - | ||||||||||||
1800 | - | |||||||||||||
1801 | \sa globalX(), globalPos() | - | ||||||||||||
1802 | */ | - | ||||||||||||
1803 | #endif // QT_NO_CONTEXTMENU | - | ||||||||||||
1804 | - | |||||||||||||
1805 | /*! | - | ||||||||||||
1806 | \enum QContextMenuEvent::Reason | - | ||||||||||||
1807 | - | |||||||||||||
1808 | This enum describes the reason why the event was sent. | - | ||||||||||||
1809 | - | |||||||||||||
1810 | \value Mouse The mouse caused the event to be sent. Normally this | - | ||||||||||||
1811 | means the right mouse button was clicked, but this is platform | - | ||||||||||||
1812 | dependent. | - | ||||||||||||
1813 | - | |||||||||||||
1814 | \value Keyboard The keyboard caused this event to be sent. On | - | ||||||||||||
1815 | Windows, this means the menu button was pressed. | - | ||||||||||||
1816 | - | |||||||||||||
1817 | \value Other The event was sent by some other means (i.e. not by | - | ||||||||||||
1818 | the mouse or keyboard). | - | ||||||||||||
1819 | */ | - | ||||||||||||
1820 | - | |||||||||||||
1821 | - | |||||||||||||
1822 | /*! | - | ||||||||||||
1823 | \fn QContextMenuEvent::Reason QContextMenuEvent::reason() const | - | ||||||||||||
1824 | - | |||||||||||||
1825 | Returns the reason for this context event. | - | ||||||||||||
1826 | */ | - | ||||||||||||
1827 | - | |||||||||||||
1828 | - | |||||||||||||
1829 | /*! | - | ||||||||||||
1830 | \class QInputMethodEvent | - | ||||||||||||
1831 | \brief The QInputMethodEvent class provides parameters for input method events. | - | ||||||||||||
1832 | \inmodule QtGui | - | ||||||||||||
1833 | - | |||||||||||||
1834 | \ingroup events | - | ||||||||||||
1835 | - | |||||||||||||
1836 | Input method events are sent to widgets when an input method is | - | ||||||||||||
1837 | used to enter text into a widget. Input methods are widely used | - | ||||||||||||
1838 | to enter text for languages with non-Latin alphabets. | - | ||||||||||||
1839 | - | |||||||||||||
1840 | Note that when creating custom text editing widgets, the | - | ||||||||||||
1841 | Qt::WA_InputMethodEnabled window attribute must be set explicitly | - | ||||||||||||
1842 | (using the QWidget::setAttribute() function) in order to receive | - | ||||||||||||
1843 | input method events. | - | ||||||||||||
1844 | - | |||||||||||||
1845 | The events are of interest to authors of keyboard entry widgets | - | ||||||||||||
1846 | who want to be able to correctly handle languages with complex | - | ||||||||||||
1847 | character input. Text input in such languages is usually a three | - | ||||||||||||
1848 | step process: | - | ||||||||||||
1849 | - | |||||||||||||
1850 | \list 1 | - | ||||||||||||
1851 | \li \b{Starting to Compose} | - | ||||||||||||
1852 | - | |||||||||||||
1853 | When the user presses the first key on a keyboard, an input | - | ||||||||||||
1854 | context is created. This input context will contain a string | - | ||||||||||||
1855 | of the typed characters. | - | ||||||||||||
1856 | - | |||||||||||||
1857 | \li \b{Composing} | - | ||||||||||||
1858 | - | |||||||||||||
1859 | With every new key pressed, the input method will try to create a | - | ||||||||||||
1860 | matching string for the text typed so far called preedit | - | ||||||||||||
1861 | string. While the input context is active, the user can only move | - | ||||||||||||
1862 | the cursor inside the string belonging to this input context. | - | ||||||||||||
1863 | - | |||||||||||||
1864 | \li \b{Completing} | - | ||||||||||||
1865 | - | |||||||||||||
1866 | At some point, the user will activate a user interface component | - | ||||||||||||
1867 | (perhaps using a particular key) where they can choose from a | - | ||||||||||||
1868 | number of strings matching the text they have typed so far. The | - | ||||||||||||
1869 | user can either confirm their choice cancel the input; in either | - | ||||||||||||
1870 | case the input context will be closed. | - | ||||||||||||
1871 | \endlist | - | ||||||||||||
1872 | - | |||||||||||||
1873 | QInputMethodEvent models these three stages, and transfers the | - | ||||||||||||
1874 | information needed to correctly render the intermediate result. A | - | ||||||||||||
1875 | QInputMethodEvent has two main parameters: preeditString() and | - | ||||||||||||
1876 | commitString(). The preeditString() parameter gives the currently | - | ||||||||||||
1877 | active preedit string. The commitString() parameter gives a text | - | ||||||||||||
1878 | that should get added to (or replace parts of) the text of the | - | ||||||||||||
1879 | editor widget. It usually is a result of the input operations and | - | ||||||||||||
1880 | has to be inserted to the widgets text directly before the preedit | - | ||||||||||||
1881 | string. | - | ||||||||||||
1882 | - | |||||||||||||
1883 | If the commitString() should replace parts of the of the text in | - | ||||||||||||
1884 | the editor, replacementLength() will contain the number of | - | ||||||||||||
1885 | characters to be replaced. replacementStart() contains the position | - | ||||||||||||
1886 | at which characters are to be replaced relative from the start of | - | ||||||||||||
1887 | the preedit string. | - | ||||||||||||
1888 | - | |||||||||||||
1889 | A number of attributes control the visual appearance of the | - | ||||||||||||
1890 | preedit string (the visual appearance of text outside the preedit | - | ||||||||||||
1891 | string is controlled by the widget only). The AttributeType enum | - | ||||||||||||
1892 | describes the different attributes that can be set. | - | ||||||||||||
1893 | - | |||||||||||||
1894 | A class implementing QWidget::inputMethodEvent() or | - | ||||||||||||
1895 | QGraphicsItem::inputMethodEvent() should at least understand and | - | ||||||||||||
1896 | honor the \l TextFormat and \l Cursor attributes. | - | ||||||||||||
1897 | - | |||||||||||||
1898 | Since input methods need to be able to query certain properties | - | ||||||||||||
1899 | from the widget or graphics item, subclasses must also implement | - | ||||||||||||
1900 | QWidget::inputMethodQuery() and QGraphicsItem::inputMethodQuery(), | - | ||||||||||||
1901 | respectively. | - | ||||||||||||
1902 | - | |||||||||||||
1903 | When receiving an input method event, the text widget has to performs the | - | ||||||||||||
1904 | following steps: | - | ||||||||||||
1905 | - | |||||||||||||
1906 | \list 1 | - | ||||||||||||
1907 | \li If the widget has selected text, the selected text should get | - | ||||||||||||
1908 | removed. | - | ||||||||||||
1909 | - | |||||||||||||
1910 | \li Remove the text starting at replacementStart() with length | - | ||||||||||||
1911 | replacementLength() and replace it by the commitString(). If | - | ||||||||||||
1912 | replacementLength() is 0, replacementStart() gives the insertion | - | ||||||||||||
1913 | position for the commitString(). | - | ||||||||||||
1914 | - | |||||||||||||
1915 | When doing replacement the area of the preedit | - | ||||||||||||
1916 | string is ignored, thus a replacement starting at -1 with a length | - | ||||||||||||
1917 | of 2 will remove the last character before the preedit string and | - | ||||||||||||
1918 | the first character afterwards, and insert the commit string | - | ||||||||||||
1919 | directly before the preedit string. | - | ||||||||||||
1920 | - | |||||||||||||
1921 | If the widget implements undo/redo, this operation gets added to | - | ||||||||||||
1922 | the undo stack. | - | ||||||||||||
1923 | - | |||||||||||||
1924 | \li If there is no current preedit string, insert the | - | ||||||||||||
1925 | preeditString() at the current cursor position; otherwise replace | - | ||||||||||||
1926 | the previous preeditString with the one received from this event. | - | ||||||||||||
1927 | - | |||||||||||||
1928 | If the widget implements undo/redo, the preeditString() should not | - | ||||||||||||
1929 | influence the undo/redo stack in any way. | - | ||||||||||||
1930 | - | |||||||||||||
1931 | The widget should examine the list of attributes to apply to the | - | ||||||||||||
1932 | preedit string. It has to understand at least the TextFormat and | - | ||||||||||||
1933 | Cursor attributes and render them as specified. | - | ||||||||||||
1934 | \endlist | - | ||||||||||||
1935 | - | |||||||||||||
1936 | \sa QInputMethod | - | ||||||||||||
1937 | */ | - | ||||||||||||
1938 | - | |||||||||||||
1939 | /*! | - | ||||||||||||
1940 | \enum QInputMethodEvent::AttributeType | - | ||||||||||||
1941 | - | |||||||||||||
1942 | \value TextFormat | - | ||||||||||||
1943 | A QTextCharFormat for the part of the preedit string specified by | - | ||||||||||||
1944 | start and length. value contains a QVariant of type QTextFormat | - | ||||||||||||
1945 | specifying rendering of this part of the preedit string. There | - | ||||||||||||
1946 | should be at most one format for every part of the preedit | - | ||||||||||||
1947 | string. If several are specified for any character in the string the | - | ||||||||||||
1948 | behaviour is undefined. A conforming implementation has to at least | - | ||||||||||||
1949 | honor the backgroundColor, textColor and fontUnderline properties | - | ||||||||||||
1950 | of the format. | - | ||||||||||||
1951 | - | |||||||||||||
1952 | \value Cursor If set, a cursor should be shown inside the preedit | - | ||||||||||||
1953 | string at position start. The length variable determines whether | - | ||||||||||||
1954 | the cursor is visible or not. If the length is 0 the cursor is | - | ||||||||||||
1955 | invisible. If value is a QVariant of type QColor this color will | - | ||||||||||||
1956 | be used for rendering the cursor, otherwise the color of the | - | ||||||||||||
1957 | surrounding text will be used. There should be at most one Cursor | - | ||||||||||||
1958 | attribute per event. If several are specified the behaviour is | - | ||||||||||||
1959 | undefined. | - | ||||||||||||
1960 | - | |||||||||||||
1961 | \value Language | - | ||||||||||||
1962 | The variant contains a QLocale object specifying the language of a | - | ||||||||||||
1963 | certain part of the preedit string. There should be at most one | - | ||||||||||||
1964 | language set for every part of the preedit string. If several are | - | ||||||||||||
1965 | specified for any character in the string the behavior is undefined. | - | ||||||||||||
1966 | - | |||||||||||||
1967 | \value Ruby | - | ||||||||||||
1968 | The ruby text for a part of the preedit string. There should be at | - | ||||||||||||
1969 | most one ruby text set for every part of the preedit string. If | - | ||||||||||||
1970 | several are specified for any character in the string the behaviour | - | ||||||||||||
1971 | is undefined. | - | ||||||||||||
1972 | - | |||||||||||||
1973 | \value Selection | - | ||||||||||||
1974 | If set, the edit cursor should be moved to the specified position | - | ||||||||||||
1975 | in the editor text contents. In contrast with \c Cursor, this | - | ||||||||||||
1976 | attribute does not work on the preedit text, but on the surrounding | - | ||||||||||||
1977 | text. The cursor will be moved after the commit string has been | - | ||||||||||||
1978 | committed, and the preedit string will be located at the new edit | - | ||||||||||||
1979 | position. | - | ||||||||||||
1980 | The start position specifies the new position and the length | - | ||||||||||||
1981 | variable can be used to set a selection starting from that point. | - | ||||||||||||
1982 | The value is unused. | - | ||||||||||||
1983 | - | |||||||||||||
1984 | \sa Attribute | - | ||||||||||||
1985 | */ | - | ||||||||||||
1986 | - | |||||||||||||
1987 | /*! | - | ||||||||||||
1988 | \class QInputMethodEvent::Attribute | - | ||||||||||||
1989 | \inmodule QtGui | - | ||||||||||||
1990 | \brief The QInputMethodEvent::Attribute class stores an input method attribute. | - | ||||||||||||
1991 | */ | - | ||||||||||||
1992 | - | |||||||||||||
1993 | /*! | - | ||||||||||||
1994 | \fn QInputMethodEvent::Attribute::Attribute(AttributeType type, int start, int length, QVariant value) | - | ||||||||||||
1995 | - | |||||||||||||
1996 | Constructs an input method attribute. \a type specifies the type | - | ||||||||||||
1997 | of attribute, \a start and \a length the position of the | - | ||||||||||||
1998 | attribute, and \a value the value of the attribute. | - | ||||||||||||
1999 | */ | - | ||||||||||||
2000 | - | |||||||||||||
2001 | /*! | - | ||||||||||||
2002 | Constructs an event of type QEvent::InputMethod. The | - | ||||||||||||
2003 | attributes(), preeditString(), commitString(), replacementStart(), | - | ||||||||||||
2004 | and replacementLength() are initialized to default values. | - | ||||||||||||
2005 | - | |||||||||||||
2006 | \sa setCommitString() | - | ||||||||||||
2007 | */ | - | ||||||||||||
2008 | QInputMethodEvent::QInputMethodEvent() | - | ||||||||||||
2009 | : QEvent(QEvent::InputMethod), replace_from(0), replace_length(0) | - | ||||||||||||
2010 | { | - | ||||||||||||
2011 | } never executed: end of block | 0 | ||||||||||||
2012 | - | |||||||||||||
2013 | /*! | - | ||||||||||||
2014 | Constructs an event of type QEvent::InputMethod. The | - | ||||||||||||
2015 | preedit text is set to \a preeditText, the attributes to | - | ||||||||||||
2016 | \a attributes. | - | ||||||||||||
2017 | - | |||||||||||||
2018 | The commitString(), replacementStart(), and replacementLength() | - | ||||||||||||
2019 | values can be set using setCommitString(). | - | ||||||||||||
2020 | - | |||||||||||||
2021 | \sa preeditString(), attributes() | - | ||||||||||||
2022 | */ | - | ||||||||||||
2023 | QInputMethodEvent::QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes) | - | ||||||||||||
2024 | : QEvent(QEvent::InputMethod), preedit(preeditText), attrs(attributes), | - | ||||||||||||
2025 | replace_from(0), replace_length(0) | - | ||||||||||||
2026 | { | - | ||||||||||||
2027 | } never executed: end of block | 0 | ||||||||||||
2028 | - | |||||||||||||
2029 | /*! | - | ||||||||||||
2030 | Constructs a copy of \a other. | - | ||||||||||||
2031 | */ | - | ||||||||||||
2032 | QInputMethodEvent::QInputMethodEvent(const QInputMethodEvent &other) | - | ||||||||||||
2033 | : QEvent(QEvent::InputMethod), preedit(other.preedit), attrs(other.attrs), | - | ||||||||||||
2034 | commit(other.commit), replace_from(other.replace_from), replace_length(other.replace_length) | - | ||||||||||||
2035 | { | - | ||||||||||||
2036 | } never executed: end of block | 0 | ||||||||||||
2037 | - | |||||||||||||
2038 | QInputMethodEvent::~QInputMethodEvent() | - | ||||||||||||
2039 | { | - | ||||||||||||
2040 | // must be empty until ### Qt 6 | - | ||||||||||||
2041 | } | - | ||||||||||||
2042 | - | |||||||||||||
2043 | /*! | - | ||||||||||||
2044 | Sets the commit string to \a commitString. | - | ||||||||||||
2045 | - | |||||||||||||
2046 | The commit string is the text that should get added to (or | - | ||||||||||||
2047 | replace parts of) the text of the editor widget. It usually is a | - | ||||||||||||
2048 | result of the input operations and has to be inserted to the | - | ||||||||||||
2049 | widgets text directly before the preedit string. | - | ||||||||||||
2050 | - | |||||||||||||
2051 | If the commit string should replace parts of the of the text in | - | ||||||||||||
2052 | the editor, \a replaceLength specifies the number of | - | ||||||||||||
2053 | characters to be replaced. \a replaceFrom specifies the position | - | ||||||||||||
2054 | at which characters are to be replaced relative from the start of | - | ||||||||||||
2055 | the preedit string. | - | ||||||||||||
2056 | - | |||||||||||||
2057 | \sa commitString(), replacementStart(), replacementLength() | - | ||||||||||||
2058 | */ | - | ||||||||||||
2059 | void QInputMethodEvent::setCommitString(const QString &commitString, int replaceFrom, int replaceLength) | - | ||||||||||||
2060 | { | - | ||||||||||||
2061 | commit = commitString; | - | ||||||||||||
2062 | replace_from = replaceFrom; | - | ||||||||||||
2063 | replace_length = replaceLength; | - | ||||||||||||
2064 | } never executed: end of block | 0 | ||||||||||||
2065 | - | |||||||||||||
2066 | /*! | - | ||||||||||||
2067 | \fn const QList<Attribute> &QInputMethodEvent::attributes() const | - | ||||||||||||
2068 | - | |||||||||||||
2069 | Returns the list of attributes passed to the QInputMethodEvent | - | ||||||||||||
2070 | constructor. The attributes control the visual appearance of the | - | ||||||||||||
2071 | preedit string (the visual appearance of text outside the preedit | - | ||||||||||||
2072 | string is controlled by the widget only). | - | ||||||||||||
2073 | - | |||||||||||||
2074 | \sa preeditString(), Attribute | - | ||||||||||||
2075 | */ | - | ||||||||||||
2076 | - | |||||||||||||
2077 | /*! | - | ||||||||||||
2078 | \fn const QString &QInputMethodEvent::preeditString() const | - | ||||||||||||
2079 | - | |||||||||||||
2080 | Returns the preedit text, i.e. the text before the user started | - | ||||||||||||
2081 | editing it. | - | ||||||||||||
2082 | - | |||||||||||||
2083 | \sa commitString(), attributes() | - | ||||||||||||
2084 | */ | - | ||||||||||||
2085 | - | |||||||||||||
2086 | /*! | - | ||||||||||||
2087 | \fn const QString &QInputMethodEvent::commitString() const | - | ||||||||||||
2088 | - | |||||||||||||
2089 | Returns the text that should get added to (or replace parts of) | - | ||||||||||||
2090 | the text of the editor widget. It usually is a result of the | - | ||||||||||||
2091 | input operations and has to be inserted to the widgets text | - | ||||||||||||
2092 | directly before the preedit string. | - | ||||||||||||
2093 | - | |||||||||||||
2094 | \sa setCommitString(), preeditString(), replacementStart(), replacementLength() | - | ||||||||||||
2095 | */ | - | ||||||||||||
2096 | - | |||||||||||||
2097 | /*! | - | ||||||||||||
2098 | \fn int QInputMethodEvent::replacementStart() const | - | ||||||||||||
2099 | - | |||||||||||||
2100 | Returns the position at which characters are to be replaced relative | - | ||||||||||||
2101 | from the start of the preedit string. | - | ||||||||||||
2102 | - | |||||||||||||
2103 | \sa replacementLength(), setCommitString() | - | ||||||||||||
2104 | */ | - | ||||||||||||
2105 | - | |||||||||||||
2106 | /*! | - | ||||||||||||
2107 | \fn int QInputMethodEvent::replacementLength() const | - | ||||||||||||
2108 | - | |||||||||||||
2109 | Returns the number of characters to be replaced in the preedit | - | ||||||||||||
2110 | string. | - | ||||||||||||
2111 | - | |||||||||||||
2112 | \sa replacementStart(), setCommitString() | - | ||||||||||||
2113 | */ | - | ||||||||||||
2114 | - | |||||||||||||
2115 | /*! | - | ||||||||||||
2116 | \class QInputMethodQueryEvent | - | ||||||||||||
2117 | \since 5.0 | - | ||||||||||||
2118 | \inmodule QtGui | - | ||||||||||||
2119 | - | |||||||||||||
2120 | \brief The QInputMethodQueryEvent class provides an event sent by the input context to input objects. | - | ||||||||||||
2121 | - | |||||||||||||
2122 | It is used by the | - | ||||||||||||
2123 | input method to query a set of properties of the object to be | - | ||||||||||||
2124 | able to support complex input method operations as support for | - | ||||||||||||
2125 | surrounding text and reconversions. | - | ||||||||||||
2126 | - | |||||||||||||
2127 | queries() specifies which properties are queried. | - | ||||||||||||
2128 | - | |||||||||||||
2129 | The object should call setValue() on the event to fill in the requested | - | ||||||||||||
2130 | data before calling accept(). | - | ||||||||||||
2131 | */ | - | ||||||||||||
2132 | - | |||||||||||||
2133 | /*! | - | ||||||||||||
2134 | \fn Qt::InputMethodQueries QInputMethodQueryEvent::queries() const | - | ||||||||||||
2135 | - | |||||||||||||
2136 | Returns the properties queried by the event. | - | ||||||||||||
2137 | */ | - | ||||||||||||
2138 | - | |||||||||||||
2139 | /*! | - | ||||||||||||
2140 | Constructs a query event for properties given by \a queries. | - | ||||||||||||
2141 | */ | - | ||||||||||||
2142 | QInputMethodQueryEvent::QInputMethodQueryEvent(Qt::InputMethodQueries queries) | - | ||||||||||||
2143 | : QEvent(InputMethodQuery), | - | ||||||||||||
2144 | m_queries(queries) | - | ||||||||||||
2145 | { | - | ||||||||||||
2146 | } never executed: end of block | 0 | ||||||||||||
2147 | - | |||||||||||||
2148 | /*! | - | ||||||||||||
2149 | \internal | - | ||||||||||||
2150 | */ | - | ||||||||||||
2151 | QInputMethodQueryEvent::~QInputMethodQueryEvent() | - | ||||||||||||
2152 | { | - | ||||||||||||
2153 | } | - | ||||||||||||
2154 | - | |||||||||||||
2155 | /*! | - | ||||||||||||
2156 | Sets property \a query to \a value. | - | ||||||||||||
2157 | */ | - | ||||||||||||
2158 | void QInputMethodQueryEvent::setValue(Qt::InputMethodQuery query, const QVariant &value) | - | ||||||||||||
2159 | { | - | ||||||||||||
2160 | for (int i = 0; i < m_values.size(); ++i) {
| 0 | ||||||||||||
2161 | if (m_values.at(i).query == query) {
| 0 | ||||||||||||
2162 | m_values[i].value = value; | - | ||||||||||||
2163 | return; never executed: return; | 0 | ||||||||||||
2164 | } | - | ||||||||||||
2165 | } never executed: end of block | 0 | ||||||||||||
2166 | QueryPair pair = { query, value }; | - | ||||||||||||
2167 | m_values.append(pair); | - | ||||||||||||
2168 | } never executed: end of block | 0 | ||||||||||||
2169 | - | |||||||||||||
2170 | /*! | - | ||||||||||||
2171 | Returns value of the property \a query. | - | ||||||||||||
2172 | */ | - | ||||||||||||
2173 | QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query) const | - | ||||||||||||
2174 | { | - | ||||||||||||
2175 | for (int i = 0; i < m_values.size(); ++i)
| 0 | ||||||||||||
2176 | if (m_values.at(i).query == query)
| 0 | ||||||||||||
2177 | return m_values.at(i).value; never executed: return m_values.at(i).value; | 0 | ||||||||||||
2178 | return QVariant(); never executed: return QVariant(); | 0 | ||||||||||||
2179 | } | - | ||||||||||||
2180 | - | |||||||||||||
2181 | #ifndef QT_NO_TABLETEVENT | - | ||||||||||||
2182 | - | |||||||||||||
2183 | /*! | - | ||||||||||||
2184 | \class QTabletEvent | - | ||||||||||||
2185 | \brief The QTabletEvent class contains parameters that describe a Tablet event. | - | ||||||||||||
2186 | \inmodule QtGui | - | ||||||||||||
2187 | - | |||||||||||||
2188 | \ingroup events | - | ||||||||||||
2189 | - | |||||||||||||
2190 | \e{Tablet events} are generated from tablet peripherals such as Wacom | - | ||||||||||||
2191 | tablets and various other brands, and electromagnetic stylus devices | - | ||||||||||||
2192 | included with some types of tablet computers. (It is not the same as | - | ||||||||||||
2193 | \l QTouchEvent which a touchscreen generates, even when a passive stylus is | - | ||||||||||||
2194 | used on a touchscreen.) | - | ||||||||||||
2195 | - | |||||||||||||
2196 | Tablet events are similar to mouse events; for example, the \l x(), \l y(), | - | ||||||||||||
2197 | \l pos(), \l globalX(), \l globalY(), and \l globalPos() accessors provide | - | ||||||||||||
2198 | the cursor position, and you can see which \l buttons() are pressed | - | ||||||||||||
2199 | (pressing the stylus tip against the tablet surface is equivalent to a left | - | ||||||||||||
2200 | mouse button). But tablet events also pass through some extra information | - | ||||||||||||
2201 | that the tablet device driver provides; for example, you might want to do | - | ||||||||||||
2202 | subpixel rendering with higher resolution coordinates (\l hiResGlobalX() | - | ||||||||||||
2203 | and \l hiResGlobalY()), adjust color brightness based on the \l pressure() | - | ||||||||||||
2204 | of the tool against the tablet surface, use different brushes depending on | - | ||||||||||||
2205 | the type of tool in use (\l device()), modulate the brush shape in some way | - | ||||||||||||
2206 | according to the X-axis and Y-axis tilt of the tool with respect to the | - | ||||||||||||
2207 | tablet surface (\l xTilt() and \l yTilt()), and use a virtual eraser | - | ||||||||||||
2208 | instead of a brush if the user switches to the other end of a double-ended | - | ||||||||||||
2209 | stylus (\l pointerType()). | - | ||||||||||||
2210 | - | |||||||||||||
2211 | Every event contains an accept flag that indicates whether the receiver | - | ||||||||||||
2212 | wants the event. You should call QTabletEvent::accept() if you handle the | - | ||||||||||||
2213 | tablet event; otherwise it will be sent to the parent widget. The exception | - | ||||||||||||
2214 | are TabletEnterProximity and TabletLeaveProximity events: these are only | - | ||||||||||||
2215 | sent to QApplication and do not check whether or not they are accepted. | - | ||||||||||||
2216 | - | |||||||||||||
2217 | The QWidget::setEnabled() function can be used to enable or disable | - | ||||||||||||
2218 | mouse, tablet and keyboard events for a widget. | - | ||||||||||||
2219 | - | |||||||||||||
2220 | The event handler QWidget::tabletEvent() receives TabletPress, | - | ||||||||||||
2221 | TabletRelease and TabletMove events. Qt will first send a | - | ||||||||||||
2222 | tablet event, then if it is not accepted by any widget, it will send a | - | ||||||||||||
2223 | mouse event. This allows users of applications that are not designed for | - | ||||||||||||
2224 | tablets to use a tablet like a mouse. However high-resolution drawing | - | ||||||||||||
2225 | applications should handle the tablet events, because they can occur at a | - | ||||||||||||
2226 | higher frequency, which is a benefit for smooth and accurate drawing. | - | ||||||||||||
2227 | If the tablet events are rejected, the synthetic mouse events may be | - | ||||||||||||
2228 | compressed for efficiency. | - | ||||||||||||
2229 | - | |||||||||||||
2230 | New in Qt 5.4: QTabletEvent includes all information available from the | - | ||||||||||||
2231 | device, including \l QTabletEvent::buttons(). Previously it was not | - | ||||||||||||
2232 | possible to accept all tablet events and also know which stylus buttons | - | ||||||||||||
2233 | were pressed. | - | ||||||||||||
2234 | - | |||||||||||||
2235 | Note that pressing the stylus button while the stylus hovers over the | - | ||||||||||||
2236 | tablet will generate a button press on some types of tablets, while on | - | ||||||||||||
2237 | other types it will be necessary to press the stylus against the tablet | - | ||||||||||||
2238 | surface in order to register the simultaneous stylus button press. | - | ||||||||||||
2239 | - | |||||||||||||
2240 | \section1 Notes for X11 Users | - | ||||||||||||
2241 | - | |||||||||||||
2242 | If the tablet is configured in xorg.conf to use the Wacom driver, there | - | ||||||||||||
2243 | will be separate XInput "devices" for the stylus, eraser, and (optionally) | - | ||||||||||||
2244 | cursor and touchpad. Qt recognizes these by their names. Otherwise, if the | - | ||||||||||||
2245 | tablet is configured to use the evdev driver, there will be only one device | - | ||||||||||||
2246 | and applications may not be able to distinguish the stylus from the eraser. | - | ||||||||||||
2247 | */ | - | ||||||||||||
2248 | - | |||||||||||||
2249 | /*! | - | ||||||||||||
2250 | \enum QTabletEvent::TabletDevice | - | ||||||||||||
2251 | - | |||||||||||||
2252 | This enum defines what type of device is generating the event. | - | ||||||||||||
2253 | - | |||||||||||||
2254 | \value NoDevice No device, or an unknown device. | - | ||||||||||||
2255 | \value Puck A Puck (a device that is similar to a flat mouse with | - | ||||||||||||
2256 | a transparent circle with cross-hairs). | - | ||||||||||||
2257 | \value Stylus A Stylus. | - | ||||||||||||
2258 | \value Airbrush An airbrush | - | ||||||||||||
2259 | \value FourDMouse A 4D Mouse. | - | ||||||||||||
2260 | \value RotationStylus A special stylus that also knows about rotation | - | ||||||||||||
2261 | (a 6D stylus). \since 4.1 | - | ||||||||||||
2262 | \omitvalue XFreeEraser | - | ||||||||||||
2263 | */ | - | ||||||||||||
2264 | - | |||||||||||||
2265 | /*! | - | ||||||||||||
2266 | \enum QTabletEvent::PointerType | - | ||||||||||||
2267 | - | |||||||||||||
2268 | This enum defines what type of point is generating the event. | - | ||||||||||||
2269 | - | |||||||||||||
2270 | \value UnknownPointer An unknown device. | - | ||||||||||||
2271 | \value Pen Tip end of a stylus-like device (the narrow end of the pen). | - | ||||||||||||
2272 | \value Cursor Any puck-like device. | - | ||||||||||||
2273 | \value Eraser Eraser end of a stylus-like device (the broad end of the pen). | - | ||||||||||||
2274 | - | |||||||||||||
2275 | \sa pointerType() | - | ||||||||||||
2276 | */ | - | ||||||||||||
2277 | - | |||||||||||||
2278 | /*! | - | ||||||||||||
2279 | Construct a tablet event of the given \a type. | - | ||||||||||||
2280 | - | |||||||||||||
2281 | The \a pos parameter indicates where the event occurred in the | - | ||||||||||||
2282 | widget; \a globalPos is the corresponding position in absolute | - | ||||||||||||
2283 | coordinates. | - | ||||||||||||
2284 | - | |||||||||||||
2285 | \a pressure contains the pressure exerted on the \a device. | - | ||||||||||||
2286 | - | |||||||||||||
2287 | \a pointerType describes the type of pen that is being used. | - | ||||||||||||
2288 | - | |||||||||||||
2289 | \a xTilt and \a yTilt contain the device's degree of tilt from the | - | ||||||||||||
2290 | x and y axes respectively. | - | ||||||||||||
2291 | - | |||||||||||||
2292 | \a keyState specifies which keyboard modifiers are pressed (e.g., | - | ||||||||||||
2293 | \uicontrol{Ctrl}). | - | ||||||||||||
2294 | - | |||||||||||||
2295 | The \a uniqueID parameter contains the unique ID for the current device. | - | ||||||||||||
2296 | - | |||||||||||||
2297 | The \a z parameter contains the coordinate of the device on the tablet, this | - | ||||||||||||
2298 | is usually given by a wheel on 4D mouse. If the device does not support a | - | ||||||||||||
2299 | Z-axis, pass zero here. | - | ||||||||||||
2300 | - | |||||||||||||
2301 | The \a tangentialPressure parameter contins the tangential pressure of an air | - | ||||||||||||
2302 | brush. If the device does not support tangential pressure, pass 0 here. | - | ||||||||||||
2303 | - | |||||||||||||
2304 | \a rotation contains the device's rotation in degrees. 4D mice and the Wacom | - | ||||||||||||
2305 | Art Pen support rotation. If the device does not support rotation, pass 0 here. | - | ||||||||||||
2306 | - | |||||||||||||
2307 | The \a button that caused the event is given as a value from the | - | ||||||||||||
2308 | \l Qt::MouseButton enum. If the event \a type is not \l TabletPress or | - | ||||||||||||
2309 | \l TabletRelease, the appropriate button for this event is \l Qt::NoButton. | - | ||||||||||||
2310 | - | |||||||||||||
2311 | \a buttons is the state of all buttons at the time of the event. | - | ||||||||||||
2312 | - | |||||||||||||
2313 | \sa pos(), globalPos(), device(), pressure(), xTilt(), yTilt(), uniqueId(), rotation(), | - | ||||||||||||
2314 | tangentialPressure(), z() | - | ||||||||||||
2315 | */ | - | ||||||||||||
2316 | - | |||||||||||||
2317 | QTabletEvent::QTabletEvent(Type type, const QPointF &pos, const QPointF &globalPos, | - | ||||||||||||
2318 | int device, int pointerType, | - | ||||||||||||
2319 | qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, | - | ||||||||||||
2320 | qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID, | - | ||||||||||||
2321 | Qt::MouseButton button, Qt::MouseButtons buttons) | - | ||||||||||||
2322 | : QInputEvent(type, keyState), | - | ||||||||||||
2323 | mPos(pos), | - | ||||||||||||
2324 | mGPos(globalPos), | - | ||||||||||||
2325 | mDev(device), | - | ||||||||||||
2326 | mPointerType(pointerType), | - | ||||||||||||
2327 | mXT(xTilt), | - | ||||||||||||
2328 | mYT(yTilt), | - | ||||||||||||
2329 | mZ(z), | - | ||||||||||||
2330 | mPress(pressure), | - | ||||||||||||
2331 | mTangential(tangentialPressure), | - | ||||||||||||
2332 | mRot(rotation), | - | ||||||||||||
2333 | mUnique(uniqueID), | - | ||||||||||||
2334 | mExtra(new QTabletEventPrivate(button, buttons)) | - | ||||||||||||
2335 | { | - | ||||||||||||
2336 | } never executed: end of block | 0 | ||||||||||||
2337 | - | |||||||||||||
2338 | /*! | - | ||||||||||||
2339 | Construct a tablet event of the given \a type. | - | ||||||||||||
2340 | - | |||||||||||||
2341 | The \a pos parameter indicates where the event occurred in the | - | ||||||||||||
2342 | widget; \a globalPos is the corresponding position in absolute | - | ||||||||||||
2343 | coordinates. | - | ||||||||||||
2344 | - | |||||||||||||
2345 | \a pressure contains the pressure exerted on the \a device. | - | ||||||||||||
2346 | - | |||||||||||||
2347 | \a pointerType describes the type of pen that is being used. | - | ||||||||||||
2348 | - | |||||||||||||
2349 | \a xTilt and \a yTilt contain the device's degree of tilt from the | - | ||||||||||||
2350 | x and y axes respectively. | - | ||||||||||||
2351 | - | |||||||||||||
2352 | \a keyState specifies which keyboard modifiers are pressed (e.g., | - | ||||||||||||
2353 | \uicontrol{Ctrl}). | - | ||||||||||||
2354 | - | |||||||||||||
2355 | The \a uniqueID parameter contains the unique ID for the current device. | - | ||||||||||||
2356 | - | |||||||||||||
2357 | The \a z parameter contains the coordinate of the device on the tablet, this | - | ||||||||||||
2358 | is usually given by a wheel on 4D mouse. If the device does not support a | - | ||||||||||||
2359 | Z-axis, pass zero here. | - | ||||||||||||
2360 | - | |||||||||||||
2361 | The \a tangentialPressure parameter contins the tangential pressure of an air | - | ||||||||||||
2362 | brush. If the device does not support tangential pressure, pass 0 here. | - | ||||||||||||
2363 | - | |||||||||||||
2364 | \a rotation contains the device's rotation in degrees. 4D mice support | - | ||||||||||||
2365 | rotation. If the device does not support rotation, pass 0 here. | - | ||||||||||||
2366 | - | |||||||||||||
2367 | \sa pos(), globalPos(), device(), pressure(), xTilt(), yTilt(), uniqueId(), rotation(), | - | ||||||||||||
2368 | tangentialPressure(), z() | - | ||||||||||||
2369 | - | |||||||||||||
2370 | \deprecated in 5.4: use the constructor with MouseButton status | - | ||||||||||||
2371 | */ | - | ||||||||||||
2372 | - | |||||||||||||
2373 | QTabletEvent::QTabletEvent(Type type, const QPointF &pos, const QPointF &globalPos, | - | ||||||||||||
2374 | int device, int pointerType, | - | ||||||||||||
2375 | qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, | - | ||||||||||||
2376 | qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID) | - | ||||||||||||
2377 | : QInputEvent(type, keyState), | - | ||||||||||||
2378 | mPos(pos), | - | ||||||||||||
2379 | mGPos(globalPos), | - | ||||||||||||
2380 | mDev(device), | - | ||||||||||||
2381 | mPointerType(pointerType), | - | ||||||||||||
2382 | mXT(xTilt), | - | ||||||||||||
2383 | mYT(yTilt), | - | ||||||||||||
2384 | mZ(z), | - | ||||||||||||
2385 | mPress(pressure), | - | ||||||||||||
2386 | mTangential(tangentialPressure), | - | ||||||||||||
2387 | mRot(rotation), | - | ||||||||||||
2388 | mUnique(uniqueID), | - | ||||||||||||
2389 | mExtra(new QTabletEventPrivate(Qt::NoButton, Qt::NoButton)) | - | ||||||||||||
2390 | { | - | ||||||||||||
2391 | } never executed: end of block | 0 | ||||||||||||
2392 | - | |||||||||||||
2393 | /*! | - | ||||||||||||
2394 | \internal | - | ||||||||||||
2395 | */ | - | ||||||||||||
2396 | QTabletEvent::~QTabletEvent() | - | ||||||||||||
2397 | { | - | ||||||||||||
2398 | } | - | ||||||||||||
2399 | - | |||||||||||||
2400 | /*! | - | ||||||||||||
2401 | Returns the button that caused the event. | - | ||||||||||||
2402 | - | |||||||||||||
2403 | Note that the returned value is always Qt::NoButton for \l TabletMove, | - | ||||||||||||
2404 | \l TabletEnterProximity and \l TabletLeaveProximity events. | - | ||||||||||||
2405 | - | |||||||||||||
2406 | \sa buttons(), Qt::MouseButton | - | ||||||||||||
2407 | */ | - | ||||||||||||
2408 | Qt::MouseButton QTabletEvent::button() const | - | ||||||||||||
2409 | { | - | ||||||||||||
2410 | return static_cast<QTabletEventPrivate *>(mExtra)->b; never executed: return static_cast<QTabletEventPrivate *>(mExtra)->b; | 0 | ||||||||||||
2411 | } | - | ||||||||||||
2412 | - | |||||||||||||
2413 | /*! | - | ||||||||||||
2414 | Returns the button state when the event was generated. The button state is | - | ||||||||||||
2415 | a combination of buttons from the \l Qt::MouseButton enum using the OR | - | ||||||||||||
2416 | operator. For \l TabletMove events, this is all buttons that are pressed | - | ||||||||||||
2417 | down. For \l TabletPress events this includes the button that caused the | - | ||||||||||||
2418 | event. For \l TabletRelease events this excludes the button that caused the | - | ||||||||||||
2419 | event. | - | ||||||||||||
2420 | - | |||||||||||||
2421 | \sa button(), Qt::MouseButton | - | ||||||||||||
2422 | */ | - | ||||||||||||
2423 | Qt::MouseButtons QTabletEvent::buttons() const | - | ||||||||||||
2424 | { | - | ||||||||||||
2425 | return static_cast<QTabletEventPrivate *>(mExtra)->buttonState; never executed: return static_cast<QTabletEventPrivate *>(mExtra)->buttonState; | 0 | ||||||||||||
2426 | } | - | ||||||||||||
2427 | - | |||||||||||||
2428 | /*! | - | ||||||||||||
2429 | \fn TabletDevices QTabletEvent::device() const | - | ||||||||||||
2430 | - | |||||||||||||
2431 | Returns the type of device that generated the event. | - | ||||||||||||
2432 | - | |||||||||||||
2433 | \sa TabletDevice | - | ||||||||||||
2434 | */ | - | ||||||||||||
2435 | - | |||||||||||||
2436 | /*! | - | ||||||||||||
2437 | \fn PointerType QTabletEvent::pointerType() const | - | ||||||||||||
2438 | - | |||||||||||||
2439 | Returns the type of point that generated the event. | - | ||||||||||||
2440 | */ | - | ||||||||||||
2441 | - | |||||||||||||
2442 | /*! | - | ||||||||||||
2443 | \fn qreal QTabletEvent::tangentialPressure() const | - | ||||||||||||
2444 | - | |||||||||||||
2445 | Returns the tangential pressure for the device. This is typically given by a finger | - | ||||||||||||
2446 | wheel on an airbrush tool. The range is from -1.0 to 1.0. 0.0 indicates a | - | ||||||||||||
2447 | neutral position. Current airbrushes can only move in the positive | - | ||||||||||||
2448 | direction from the neutrual position. If the device does not support | - | ||||||||||||
2449 | tangential pressure, this value is always 0.0. | - | ||||||||||||
2450 | - | |||||||||||||
2451 | \sa pressure() | - | ||||||||||||
2452 | */ | - | ||||||||||||
2453 | - | |||||||||||||
2454 | /*! | - | ||||||||||||
2455 | \fn qreal QTabletEvent::rotation() const | - | ||||||||||||
2456 | - | |||||||||||||
2457 | Returns the rotation of the current device in degress. This is usually | - | ||||||||||||
2458 | given by a 4D Mouse. If the device does not support rotation this value is | - | ||||||||||||
2459 | always 0.0. | - | ||||||||||||
2460 | - | |||||||||||||
2461 | */ | - | ||||||||||||
2462 | - | |||||||||||||
2463 | /*! | - | ||||||||||||
2464 | \fn qreal QTabletEvent::pressure() const | - | ||||||||||||
2465 | - | |||||||||||||
2466 | Returns the pressure for the device. 0.0 indicates that the stylus is not | - | ||||||||||||
2467 | on the tablet, 1.0 indicates the maximum amount of pressure for the stylus. | - | ||||||||||||
2468 | - | |||||||||||||
2469 | \sa tangentialPressure() | - | ||||||||||||
2470 | */ | - | ||||||||||||
2471 | - | |||||||||||||
2472 | /*! | - | ||||||||||||
2473 | \fn int QTabletEvent::xTilt() const | - | ||||||||||||
2474 | - | |||||||||||||
2475 | Returns the angle between the device (a pen, for example) and the | - | ||||||||||||
2476 | perpendicular in the direction of the x axis. | - | ||||||||||||
2477 | Positive values are towards the tablet's physical right. The angle | - | ||||||||||||
2478 | is in the range -60 to +60 degrees. | - | ||||||||||||
2479 | - | |||||||||||||
2480 | \image qtabletevent-tilt.png | - | ||||||||||||
2481 | - | |||||||||||||
2482 | \sa yTilt() | - | ||||||||||||
2483 | */ | - | ||||||||||||
2484 | - | |||||||||||||
2485 | /*! | - | ||||||||||||
2486 | \fn int QTabletEvent::yTilt() const | - | ||||||||||||
2487 | - | |||||||||||||
2488 | Returns the angle between the device (a pen, for example) and the | - | ||||||||||||
2489 | perpendicular in the direction of the y axis. | - | ||||||||||||
2490 | Positive values are towards the bottom of the tablet. The angle is | - | ||||||||||||
2491 | within the range -60 to +60 degrees. | - | ||||||||||||
2492 | - | |||||||||||||
2493 | \sa xTilt() | - | ||||||||||||
2494 | */ | - | ||||||||||||
2495 | - | |||||||||||||
2496 | /*! | - | ||||||||||||
2497 | \fn QPoint QTabletEvent::pos() const | - | ||||||||||||
2498 | - | |||||||||||||
2499 | Returns the position of the device, relative to the widget that | - | ||||||||||||
2500 | received the event. | - | ||||||||||||
2501 | - | |||||||||||||
2502 | If you move widgets around in response to mouse events, use | - | ||||||||||||
2503 | globalPos() instead of this function. | - | ||||||||||||
2504 | - | |||||||||||||
2505 | \sa x(), y(), globalPos() | - | ||||||||||||
2506 | */ | - | ||||||||||||
2507 | - | |||||||||||||
2508 | /*! | - | ||||||||||||
2509 | \fn int QTabletEvent::x() const | - | ||||||||||||
2510 | - | |||||||||||||
2511 | Returns the x position of the device, relative to the widget that | - | ||||||||||||
2512 | received the event. | - | ||||||||||||
2513 | - | |||||||||||||
2514 | \sa y(), pos() | - | ||||||||||||
2515 | */ | - | ||||||||||||
2516 | - | |||||||||||||
2517 | /*! | - | ||||||||||||
2518 | \fn int QTabletEvent::y() const | - | ||||||||||||
2519 | - | |||||||||||||
2520 | Returns the y position of the device, relative to the widget that | - | ||||||||||||
2521 | received the event. | - | ||||||||||||
2522 | - | |||||||||||||
2523 | \sa x(), pos() | - | ||||||||||||
2524 | */ | - | ||||||||||||
2525 | - | |||||||||||||
2526 | /*! | - | ||||||||||||
2527 | \fn int QTabletEvent::z() const | - | ||||||||||||
2528 | - | |||||||||||||
2529 | Returns the z position of the device. Typically this is represented by a | - | ||||||||||||
2530 | wheel on a 4D Mouse. If the device does not support a Z-axis, this value is | - | ||||||||||||
2531 | always zero. This is \b not the same as pressure. | - | ||||||||||||
2532 | - | |||||||||||||
2533 | \sa pressure() | - | ||||||||||||
2534 | */ | - | ||||||||||||
2535 | - | |||||||||||||
2536 | /*! | - | ||||||||||||
2537 | \fn QPoint QTabletEvent::globalPos() const | - | ||||||||||||
2538 | - | |||||||||||||
2539 | Returns the global position of the device \e{at the time of the | - | ||||||||||||
2540 | event}. This is important on asynchronous windows systems like X11; | - | ||||||||||||
2541 | whenever you move your widgets around in response to mouse events, | - | ||||||||||||
2542 | globalPos() can differ significantly from the current position | - | ||||||||||||
2543 | QCursor::pos(). | - | ||||||||||||
2544 | - | |||||||||||||
2545 | \sa globalX(), globalY(), hiResGlobalPos() | - | ||||||||||||
2546 | */ | - | ||||||||||||
2547 | - | |||||||||||||
2548 | /*! | - | ||||||||||||
2549 | \fn int QTabletEvent::globalX() const | - | ||||||||||||
2550 | - | |||||||||||||
2551 | Returns the global x position of the mouse pointer at the time of | - | ||||||||||||
2552 | the event. | - | ||||||||||||
2553 | - | |||||||||||||
2554 | \sa globalY(), globalPos(), hiResGlobalX() | - | ||||||||||||
2555 | */ | - | ||||||||||||
2556 | - | |||||||||||||
2557 | /*! | - | ||||||||||||
2558 | \fn int QTabletEvent::globalY() const | - | ||||||||||||
2559 | - | |||||||||||||
2560 | Returns the global y position of the tablet device at the time of | - | ||||||||||||
2561 | the event. | - | ||||||||||||
2562 | - | |||||||||||||
2563 | \sa globalX(), globalPos(), hiResGlobalY() | - | ||||||||||||
2564 | */ | - | ||||||||||||
2565 | - | |||||||||||||
2566 | /*! | - | ||||||||||||
2567 | \fn qint64 QTabletEvent::uniqueId() const | - | ||||||||||||
2568 | - | |||||||||||||
2569 | Returns a unique ID for the current device, making it possible | - | ||||||||||||
2570 | to differentiate between multiple devices being used at the same | - | ||||||||||||
2571 | time on the tablet. | - | ||||||||||||
2572 | - | |||||||||||||
2573 | Support of this feature is dependent on the tablet. | - | ||||||||||||
2574 | - | |||||||||||||
2575 | Values for the same device may vary from OS to OS. | - | ||||||||||||
2576 | - | |||||||||||||
2577 | Later versions of the Wacom driver for Linux will now report | - | ||||||||||||
2578 | the ID information. If you have a tablet that supports unique ID | - | ||||||||||||
2579 | and are not getting the information on Linux, consider upgrading | - | ||||||||||||
2580 | your driver. | - | ||||||||||||
2581 | - | |||||||||||||
2582 | As of Qt 4.2, the unique ID is the same regardless of the orientation | - | ||||||||||||
2583 | of the pen. Earlier versions would report a different value when using | - | ||||||||||||
2584 | the eraser-end versus the pen-end of the stylus on some OS's. | - | ||||||||||||
2585 | - | |||||||||||||
2586 | \sa pointerType() | - | ||||||||||||
2587 | */ | - | ||||||||||||
2588 | - | |||||||||||||
2589 | /*! | - | ||||||||||||
2590 | \fn const QPointF &QTabletEvent::hiResGlobalPos() const | - | ||||||||||||
2591 | - | |||||||||||||
2592 | The high precision coordinates delivered from the tablet expressed. | - | ||||||||||||
2593 | Sub pixeling information is in the fractional part of the QPointF. | - | ||||||||||||
2594 | - | |||||||||||||
2595 | \sa globalPos(), hiResGlobalX(), hiResGlobalY() | - | ||||||||||||
2596 | */ | - | ||||||||||||
2597 | - | |||||||||||||
2598 | /*! | - | ||||||||||||
2599 | \fn qreal &QTabletEvent::hiResGlobalX() const | - | ||||||||||||
2600 | - | |||||||||||||
2601 | The high precision x position of the tablet device. | - | ||||||||||||
2602 | */ | - | ||||||||||||
2603 | - | |||||||||||||
2604 | /*! | - | ||||||||||||
2605 | \fn qreal &QTabletEvent::hiResGlobalY() const | - | ||||||||||||
2606 | - | |||||||||||||
2607 | The high precision y position of the tablet device. | - | ||||||||||||
2608 | */ | - | ||||||||||||
2609 | - | |||||||||||||
2610 | /*! | - | ||||||||||||
2611 | \fn const QPointF &QTabletEvent::posF() const | - | ||||||||||||
2612 | - | |||||||||||||
2613 | Returns the position of the device, relative to the widget that | - | ||||||||||||
2614 | received the event. | - | ||||||||||||
2615 | - | |||||||||||||
2616 | If you move widgets around in response to mouse events, use | - | ||||||||||||
2617 | globalPosF() instead of this function. | - | ||||||||||||
2618 | - | |||||||||||||
2619 | \sa globalPosF() | - | ||||||||||||
2620 | */ | - | ||||||||||||
2621 | - | |||||||||||||
2622 | /*! | - | ||||||||||||
2623 | \fn const QPointF &QTabletEvent::globalPosF() const | - | ||||||||||||
2624 | - | |||||||||||||
2625 | Returns the global position of the device \e{at the time of the | - | ||||||||||||
2626 | event}. This is important on asynchronous windows systems like X11; | - | ||||||||||||
2627 | whenever you move your widgets around in response to mouse events, | - | ||||||||||||
2628 | globalPosF() can differ significantly from the current position | - | ||||||||||||
2629 | QCursor::pos(). | - | ||||||||||||
2630 | - | |||||||||||||
2631 | \sa posF() | - | ||||||||||||
2632 | */ | - | ||||||||||||
2633 | - | |||||||||||||
2634 | #endif // QT_NO_TABLETEVENT | - | ||||||||||||
2635 | - | |||||||||||||
2636 | #ifndef QT_NO_GESTURES | - | ||||||||||||
2637 | /*! | - | ||||||||||||
2638 | \class QNativeGestureEvent | - | ||||||||||||
2639 | \since 5.2 | - | ||||||||||||
2640 | \brief The QNativeGestureEvent class contains parameters that describe a gesture event. | - | ||||||||||||
2641 | \inmodule QtGui | - | ||||||||||||
2642 | \ingroup events | - | ||||||||||||
2643 | - | |||||||||||||
2644 | Native gesture events are generated by the operating system, typically by | - | ||||||||||||
2645 | interpreting touch events. Gesture events are high-level events such | - | ||||||||||||
2646 | as zoom or rotate. | - | ||||||||||||
2647 | - | |||||||||||||
2648 | \table | - | ||||||||||||
2649 | \header | - | ||||||||||||
2650 | \li Event Type | - | ||||||||||||
2651 | \li Description | - | ||||||||||||
2652 | \li Touch equence | - | ||||||||||||
2653 | \row | - | ||||||||||||
2654 | \li Qt::ZoomNativeGesture | - | ||||||||||||
2655 | \li Magnification delta in percent. | - | ||||||||||||
2656 | \li \macos: Two-finger pinch. | - | ||||||||||||
2657 | \row | - | ||||||||||||
2658 | \li Qt::SmartZoomNativeGesture | - | ||||||||||||
2659 | \li Boolean magnification state. | - | ||||||||||||
2660 | \li \macos: Two-finger douple tap (trackpad) / One-finger douple tap (magic mouse). | - | ||||||||||||
2661 | \row | - | ||||||||||||
2662 | \li Qt::RotateNativeGesture | - | ||||||||||||
2663 | \li Rotation delta in degrees. | - | ||||||||||||
2664 | \li \macos: Two-finger rotate. | - | ||||||||||||
2665 | \endtable | - | ||||||||||||
2666 | - | |||||||||||||
2667 | - | |||||||||||||
2668 | In addition, BeginNativeGesture and EndNativeGesture are sent before and after | - | ||||||||||||
2669 | gesture event streams: | - | ||||||||||||
2670 | - | |||||||||||||
2671 | BeginNativeGesture | - | ||||||||||||
2672 | ZoomNativeGesture | - | ||||||||||||
2673 | ZoomNativeGesture | - | ||||||||||||
2674 | ZoomNativeGesture | - | ||||||||||||
2675 | EndNativeGesture | - | ||||||||||||
2676 | - | |||||||||||||
2677 | \sa Qt::NativeGestureType, QGestureEvent | - | ||||||||||||
2678 | */ | - | ||||||||||||
2679 | - | |||||||||||||
2680 | /*! | - | ||||||||||||
2681 | Constructs a native gesture event of type \a type. | - | ||||||||||||
2682 | - | |||||||||||||
2683 | The points \a localPos, \a windowPos and \a screenPos specify the | - | ||||||||||||
2684 | gesture position relative to the receiving widget or item, | - | ||||||||||||
2685 | window, and screen, respectively. | - | ||||||||||||
2686 | - | |||||||||||||
2687 | \a realValue is the \macos event parameter, \a sequenceId and \a intValue are the Windows event parameters. | - | ||||||||||||
2688 | */ | - | ||||||||||||
2689 | QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos, | - | ||||||||||||
2690 | const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue) | - | ||||||||||||
2691 | : QInputEvent(QEvent::NativeGesture), mGestureType(type), | - | ||||||||||||
2692 | mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue), | - | ||||||||||||
2693 | mSequenceId(sequenceId), mIntValue(intValue) | - | ||||||||||||
2694 | { never executed: }end of block never executed: end of block | 0 | ||||||||||||
2695 | - | |||||||||||||
2696 | /*! | - | ||||||||||||
2697 | \fn QNativeGestureEvent::gestureType() const | - | ||||||||||||
2698 | \since 5.2 | - | ||||||||||||
2699 | - | |||||||||||||
2700 | Returns the gesture type. | - | ||||||||||||
2701 | */ | - | ||||||||||||
2702 | - | |||||||||||||
2703 | /*! | - | ||||||||||||
2704 | \fn QNativeGestureEvent::value() const | - | ||||||||||||
2705 | \since 5.2 | - | ||||||||||||
2706 | - | |||||||||||||
2707 | Returns the gesture value. The value should be interpreted based on the | - | ||||||||||||
2708 | gesture type. For example, a Zoom gesture provides a scale factor while a Rotate | - | ||||||||||||
2709 | gesture provides a rotation delta. | - | ||||||||||||
2710 | - | |||||||||||||
2711 | \sa QNativeGestureEvent, gestureType() | - | ||||||||||||
2712 | */ | - | ||||||||||||
2713 | - | |||||||||||||
2714 | /*! | - | ||||||||||||
2715 | \fn QPoint QNativeGestureEvent::globalPos() const | - | ||||||||||||
2716 | \since 5.2 | - | ||||||||||||
2717 | - | |||||||||||||
2718 | Returns the position of the gesture as a QPointF in screen coordinates | - | ||||||||||||
2719 | */ | - | ||||||||||||
2720 | - | |||||||||||||
2721 | /*! | - | ||||||||||||
2722 | \fn QPoint QNativeGestureEvent::pos() const | - | ||||||||||||
2723 | \since 5.2 | - | ||||||||||||
2724 | - | |||||||||||||
2725 | Returns the position of the mouse cursor, relative to the widget | - | ||||||||||||
2726 | or item that received the event. | - | ||||||||||||
2727 | */ | - | ||||||||||||
2728 | - | |||||||||||||
2729 | /*! | - | ||||||||||||
2730 | \fn QPointF QNativeGestureEvent::localPos() const | - | ||||||||||||
2731 | \since 5.2 | - | ||||||||||||
2732 | - | |||||||||||||
2733 | Returns the position of the gesture as a QPointF, relative to the | - | ||||||||||||
2734 | widget or item that received the event. | - | ||||||||||||
2735 | */ | - | ||||||||||||
2736 | - | |||||||||||||
2737 | /*! | - | ||||||||||||
2738 | \fn QPointF QNativeGestureEvent::screenPos() const | - | ||||||||||||
2739 | \since 5.2 | - | ||||||||||||
2740 | - | |||||||||||||
2741 | Returns the position of the gesture as a QPointF in screen coordinates. | - | ||||||||||||
2742 | */ | - | ||||||||||||
2743 | - | |||||||||||||
2744 | /*! | - | ||||||||||||
2745 | \fn QPointF QNativeGestureEvent::windowPos() const | - | ||||||||||||
2746 | \since 5.2 | - | ||||||||||||
2747 | - | |||||||||||||
2748 | Returns the position of the gesture as a QPointF, relative to the | - | ||||||||||||
2749 | window that received the event. | - | ||||||||||||
2750 | */ | - | ||||||||||||
2751 | #endif // QT_NO_GESTURES | - | ||||||||||||
2752 | - | |||||||||||||
2753 | #ifndef QT_NO_DRAGANDDROP | - | ||||||||||||
2754 | /*! | - | ||||||||||||
2755 | Creates a QDragMoveEvent of the required \a type indicating | - | ||||||||||||
2756 | that the mouse is at position \a pos given within a widget. | - | ||||||||||||
2757 | - | |||||||||||||
2758 | The mouse and keyboard states are specified by \a buttons and | - | ||||||||||||
2759 | \a modifiers, and the \a actions describe the types of drag | - | ||||||||||||
2760 | and drop operation that are possible. | - | ||||||||||||
2761 | The drag data is passed as MIME-encoded information in \a data. | - | ||||||||||||
2762 | - | |||||||||||||
2763 | \warning Do not attempt to create a QDragMoveEvent yourself. | - | ||||||||||||
2764 | These objects rely on Qt's internal state. | - | ||||||||||||
2765 | */ | - | ||||||||||||
2766 | QDragMoveEvent::QDragMoveEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data, | - | ||||||||||||
2767 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type) | - | ||||||||||||
2768 | : QDropEvent(pos, actions, data, buttons, modifiers, type) | - | ||||||||||||
2769 | , rect(pos, QSize(1, 1)) | - | ||||||||||||
2770 | {} never executed: end of block | 0 | ||||||||||||
2771 | - | |||||||||||||
2772 | /*! | - | ||||||||||||
2773 | Destroys the event. | - | ||||||||||||
2774 | */ | - | ||||||||||||
2775 | QDragMoveEvent::~QDragMoveEvent() | - | ||||||||||||
2776 | { | - | ||||||||||||
2777 | } | - | ||||||||||||
2778 | - | |||||||||||||
2779 | /*! | - | ||||||||||||
2780 | \fn void QDragMoveEvent::accept(const QRect &rectangle) | - | ||||||||||||
2781 | - | |||||||||||||
2782 | The same as accept(), but also notifies that future moves will | - | ||||||||||||
2783 | also be acceptable if they remain within the \a rectangle | - | ||||||||||||
2784 | given on the widget. This can improve performance, but may | - | ||||||||||||
2785 | also be ignored by the underlying system. | - | ||||||||||||
2786 | - | |||||||||||||
2787 | If the rectangle is empty, drag move events will be sent | - | ||||||||||||
2788 | continuously. This is useful if the source is scrolling in a | - | ||||||||||||
2789 | timer event. | - | ||||||||||||
2790 | */ | - | ||||||||||||
2791 | - | |||||||||||||
2792 | /*! | - | ||||||||||||
2793 | \fn void QDragMoveEvent::accept() | - | ||||||||||||
2794 | - | |||||||||||||
2795 | \overload | - | ||||||||||||
2796 | - | |||||||||||||
2797 | Calls QDropEvent::accept(). | - | ||||||||||||
2798 | */ | - | ||||||||||||
2799 | - | |||||||||||||
2800 | /*! | - | ||||||||||||
2801 | \fn void QDragMoveEvent::ignore() | - | ||||||||||||
2802 | - | |||||||||||||
2803 | \overload | - | ||||||||||||
2804 | - | |||||||||||||
2805 | Calls QDropEvent::ignore(). | - | ||||||||||||
2806 | */ | - | ||||||||||||
2807 | - | |||||||||||||
2808 | /*! | - | ||||||||||||
2809 | \fn void QDragMoveEvent::ignore(const QRect &rectangle) | - | ||||||||||||
2810 | - | |||||||||||||
2811 | The opposite of the accept(const QRect&) function. | - | ||||||||||||
2812 | Moves within the \a rectangle are not acceptable, and will be | - | ||||||||||||
2813 | ignored. | - | ||||||||||||
2814 | */ | - | ||||||||||||
2815 | - | |||||||||||||
2816 | /*! | - | ||||||||||||
2817 | \fn QRect QDragMoveEvent::answerRect() const | - | ||||||||||||
2818 | - | |||||||||||||
2819 | Returns the rectangle in the widget where the drop will occur if accepted. | - | ||||||||||||
2820 | You can use this information to restrict drops to certain places on the | - | ||||||||||||
2821 | widget. | - | ||||||||||||
2822 | */ | - | ||||||||||||
2823 | - | |||||||||||||
2824 | - | |||||||||||||
2825 | /*! | - | ||||||||||||
2826 | \class QDropEvent | - | ||||||||||||
2827 | \ingroup events | - | ||||||||||||
2828 | \ingroup draganddrop | - | ||||||||||||
2829 | \inmodule QtGui | - | ||||||||||||
2830 | - | |||||||||||||
2831 | \brief The QDropEvent class provides an event which is sent when a | - | ||||||||||||
2832 | drag and drop action is completed. | - | ||||||||||||
2833 | - | |||||||||||||
2834 | When a widget \l{QWidget::setAcceptDrops()}{accepts drop events}, it will | - | ||||||||||||
2835 | receive this event if it has accepted the most recent QDragEnterEvent or | - | ||||||||||||
2836 | QDragMoveEvent sent to it. | - | ||||||||||||
2837 | - | |||||||||||||
2838 | The drop event contains a proposed action, available from proposedAction(), for | - | ||||||||||||
2839 | the widget to either accept or ignore. If the action can be handled by the | - | ||||||||||||
2840 | widget, you should call the acceptProposedAction() function. Since the | - | ||||||||||||
2841 | proposed action can be a combination of \l Qt::DropAction values, it may be | - | ||||||||||||
2842 | useful to either select one of these values as a default action or ask | - | ||||||||||||
2843 | the user to select their preferred action. | - | ||||||||||||
2844 | - | |||||||||||||
2845 | If the proposed drop action is not suitable, perhaps because your custom | - | ||||||||||||
2846 | widget does not support that action, you can replace it with any of the | - | ||||||||||||
2847 | \l{possibleActions()}{possible drop actions} by calling setDropAction() | - | ||||||||||||
2848 | with your preferred action. If you set a value that is not present in the | - | ||||||||||||
2849 | bitwise OR combination of values returned by possibleActions(), the default | - | ||||||||||||
2850 | copy action will be used. Once a replacement drop action has been set, call | - | ||||||||||||
2851 | accept() instead of acceptProposedAction() to complete the drop operation. | - | ||||||||||||
2852 | - | |||||||||||||
2853 | The mimeData() function provides the data dropped on the widget in a QMimeData | - | ||||||||||||
2854 | object. This contains information about the MIME type of the data in addition to | - | ||||||||||||
2855 | the data itself. | - | ||||||||||||
2856 | - | |||||||||||||
2857 | \sa QMimeData, QDrag, {Drag and Drop} | - | ||||||||||||
2858 | */ | - | ||||||||||||
2859 | - | |||||||||||||
2860 | /*! | - | ||||||||||||
2861 | \fn const QMimeData *QDropEvent::mimeData() const | - | ||||||||||||
2862 | - | |||||||||||||
2863 | Returns the data that was dropped on the widget and its associated MIME | - | ||||||||||||
2864 | type information. | - | ||||||||||||
2865 | */ | - | ||||||||||||
2866 | - | |||||||||||||
2867 | /*! | - | ||||||||||||
2868 | Constructs a drop event of a certain \a type corresponding to a | - | ||||||||||||
2869 | drop at the point specified by \a pos in the destination widget's | - | ||||||||||||
2870 | coordinate system. | - | ||||||||||||
2871 | - | |||||||||||||
2872 | The \a actions indicate which types of drag and drop operation can | - | ||||||||||||
2873 | be performed, and the drag data is stored as MIME-encoded data in \a data. | - | ||||||||||||
2874 | - | |||||||||||||
2875 | The states of the mouse buttons and keyboard modifiers at the time of | - | ||||||||||||
2876 | the drop are specified by \a buttons and \a modifiers. | - | ||||||||||||
2877 | */ // ### pos is in which coordinate system? | - | ||||||||||||
2878 | QDropEvent::QDropEvent(const QPointF& pos, Qt::DropActions actions, const QMimeData *data, | - | ||||||||||||
2879 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type) | - | ||||||||||||
2880 | : QEvent(type), p(pos), mouseState(buttons), | - | ||||||||||||
2881 | modState(modifiers), act(actions), | - | ||||||||||||
2882 | mdata(data) | - | ||||||||||||
2883 | { | - | ||||||||||||
2884 | default_action = QGuiApplicationPrivate::platformIntegration()->drag()->defaultAction(act, modifiers); | - | ||||||||||||
2885 | drop_action = default_action; | - | ||||||||||||
2886 | ignore(); | - | ||||||||||||
2887 | } never executed: end of block | 0 | ||||||||||||
2888 | - | |||||||||||||
2889 | /*! \internal */ | - | ||||||||||||
2890 | QDropEvent::~QDropEvent() | - | ||||||||||||
2891 | { | - | ||||||||||||
2892 | } | - | ||||||||||||
2893 | - | |||||||||||||
2894 | - | |||||||||||||
2895 | /*! | - | ||||||||||||
2896 | If the source of the drag operation is a widget in this | - | ||||||||||||
2897 | application, this function returns that source; otherwise it | - | ||||||||||||
2898 | returns 0. The source of the operation is the first parameter to | - | ||||||||||||
2899 | the QDrag object used instantiate the drag. | - | ||||||||||||
2900 | - | |||||||||||||
2901 | This is useful if your widget needs special behavior when dragging | - | ||||||||||||
2902 | to itself. | - | ||||||||||||
2903 | - | |||||||||||||
2904 | \sa QDrag::QDrag() | - | ||||||||||||
2905 | */ | - | ||||||||||||
2906 | QObject* QDropEvent::source() const | - | ||||||||||||
2907 | { | - | ||||||||||||
2908 | if (const QDragManager *manager = QDragManager::self())
| 0 | ||||||||||||
2909 | return manager->source(); never executed: return manager->source(); | 0 | ||||||||||||
2910 | return 0; never executed: return 0; | 0 | ||||||||||||
2911 | } | - | ||||||||||||
2912 | - | |||||||||||||
2913 | - | |||||||||||||
2914 | void QDropEvent::setDropAction(Qt::DropAction action) | - | ||||||||||||
2915 | { | - | ||||||||||||
2916 | if (!(action & act) && action != Qt::IgnoreAction)
| 0 | ||||||||||||
2917 | action = default_action; never executed: action = default_action; | 0 | ||||||||||||
2918 | drop_action = action; | - | ||||||||||||
2919 | } never executed: end of block | 0 | ||||||||||||
2920 | - | |||||||||||||
2921 | /*! | - | ||||||||||||
2922 | \fn QPoint QDropEvent::pos() const | - | ||||||||||||
2923 | - | |||||||||||||
2924 | Returns the position where the drop was made. | - | ||||||||||||
2925 | */ | - | ||||||||||||
2926 | - | |||||||||||||
2927 | /*! | - | ||||||||||||
2928 | \fn const QPointF& QDropEvent::posF() const | - | ||||||||||||
2929 | - | |||||||||||||
2930 | Returns the position where the drop was made. | - | ||||||||||||
2931 | */ | - | ||||||||||||
2932 | - | |||||||||||||
2933 | /*! | - | ||||||||||||
2934 | \fn Qt::MouseButtons QDropEvent::mouseButtons() const | - | ||||||||||||
2935 | - | |||||||||||||
2936 | Returns the mouse buttons that are pressed.. | - | ||||||||||||
2937 | */ | - | ||||||||||||
2938 | - | |||||||||||||
2939 | /*! | - | ||||||||||||
2940 | \fn Qt::KeyboardModifiers QDropEvent::keyboardModifiers() const | - | ||||||||||||
2941 | - | |||||||||||||
2942 | Returns the modifier keys that are pressed. | - | ||||||||||||
2943 | */ | - | ||||||||||||
2944 | - | |||||||||||||
2945 | /*! | - | ||||||||||||
2946 | \fn void QDropEvent::setDropAction(Qt::DropAction action) | - | ||||||||||||
2947 | - | |||||||||||||
2948 | Sets the \a action to be performed on the data by the target. | - | ||||||||||||
2949 | Use this to override the \l{proposedAction()}{proposed action} | - | ||||||||||||
2950 | with one of the \l{possibleActions()}{possible actions}. | - | ||||||||||||
2951 | - | |||||||||||||
2952 | If you set a drop action that is not one of the possible actions, the | - | ||||||||||||
2953 | drag and drop operation will default to a copy operation. | - | ||||||||||||
2954 | - | |||||||||||||
2955 | Once you have supplied a replacement drop action, call accept() | - | ||||||||||||
2956 | instead of acceptProposedAction(). | - | ||||||||||||
2957 | - | |||||||||||||
2958 | \sa dropAction() | - | ||||||||||||
2959 | */ | - | ||||||||||||
2960 | - | |||||||||||||
2961 | /*! | - | ||||||||||||
2962 | \fn Qt::DropAction QDropEvent::dropAction() const | - | ||||||||||||
2963 | - | |||||||||||||
2964 | Returns the action to be performed on the data by the target. This may be | - | ||||||||||||
2965 | different from the action supplied in proposedAction() if you have called | - | ||||||||||||
2966 | setDropAction() to explicitly choose a drop action. | - | ||||||||||||
2967 | - | |||||||||||||
2968 | \sa setDropAction() | - | ||||||||||||
2969 | */ | - | ||||||||||||
2970 | - | |||||||||||||
2971 | /*! | - | ||||||||||||
2972 | \fn Qt::DropActions QDropEvent::possibleActions() const | - | ||||||||||||
2973 | - | |||||||||||||
2974 | Returns an OR-combination of possible drop actions. | - | ||||||||||||
2975 | - | |||||||||||||
2976 | \sa dropAction() | - | ||||||||||||
2977 | */ | - | ||||||||||||
2978 | - | |||||||||||||
2979 | /*! | - | ||||||||||||
2980 | \fn Qt::DropAction QDropEvent::proposedAction() const | - | ||||||||||||
2981 | - | |||||||||||||
2982 | Returns the proposed drop action. | - | ||||||||||||
2983 | - | |||||||||||||
2984 | \sa dropAction() | - | ||||||||||||
2985 | */ | - | ||||||||||||
2986 | - | |||||||||||||
2987 | /*! | - | ||||||||||||
2988 | \fn void QDropEvent::acceptProposedAction() | - | ||||||||||||
2989 | - | |||||||||||||
2990 | Sets the drop action to be the proposed action. | - | ||||||||||||
2991 | - | |||||||||||||
2992 | \sa setDropAction(), proposedAction(), {QEvent::accept()}{accept()} | - | ||||||||||||
2993 | */ | - | ||||||||||||
2994 | - | |||||||||||||
2995 | /*! | - | ||||||||||||
2996 | \class QDragEnterEvent | - | ||||||||||||
2997 | \brief The QDragEnterEvent class provides an event which is sent | - | ||||||||||||
2998 | to a widget when a drag and drop action enters it. | - | ||||||||||||
2999 | - | |||||||||||||
3000 | \ingroup events | - | ||||||||||||
3001 | \ingroup draganddrop | - | ||||||||||||
3002 | \inmodule QtGui | - | ||||||||||||
3003 | - | |||||||||||||
3004 | A widget must accept this event in order to receive the \l | - | ||||||||||||
3005 | {QDragMoveEvent}{drag move events} that are sent while the drag | - | ||||||||||||
3006 | and drop action is in progress. The drag enter event is always | - | ||||||||||||
3007 | immediately followed by a drag move event. | - | ||||||||||||
3008 | - | |||||||||||||
3009 | QDragEnterEvent inherits most of its functionality from | - | ||||||||||||
3010 | QDragMoveEvent, which in turn inherits most of its functionality | - | ||||||||||||
3011 | from QDropEvent. | - | ||||||||||||
3012 | - | |||||||||||||
3013 | \sa QDragLeaveEvent, QDragMoveEvent, QDropEvent | - | ||||||||||||
3014 | */ | - | ||||||||||||
3015 | - | |||||||||||||
3016 | /*! | - | ||||||||||||
3017 | Constructs a QDragEnterEvent that represents a drag entering a | - | ||||||||||||
3018 | widget at the given \a point with mouse and keyboard states specified by | - | ||||||||||||
3019 | \a buttons and \a modifiers. | - | ||||||||||||
3020 | - | |||||||||||||
3021 | The drag data is passed as MIME-encoded information in \a data, and the | - | ||||||||||||
3022 | specified \a actions describe the possible types of drag and drop | - | ||||||||||||
3023 | operation that can be performed. | - | ||||||||||||
3024 | - | |||||||||||||
3025 | \warning Do not create a QDragEnterEvent yourself since these | - | ||||||||||||
3026 | objects rely on Qt's internal state. | - | ||||||||||||
3027 | */ | - | ||||||||||||
3028 | QDragEnterEvent::QDragEnterEvent(const QPoint& point, Qt::DropActions actions, const QMimeData *data, | - | ||||||||||||
3029 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) | - | ||||||||||||
3030 | : QDragMoveEvent(point, actions, data, buttons, modifiers, DragEnter) | - | ||||||||||||
3031 | {} never executed: end of block | 0 | ||||||||||||
3032 | - | |||||||||||||
3033 | /*! \internal | - | ||||||||||||
3034 | */ | - | ||||||||||||
3035 | QDragEnterEvent::~QDragEnterEvent() | - | ||||||||||||
3036 | { | - | ||||||||||||
3037 | } | - | ||||||||||||
3038 | - | |||||||||||||
3039 | /*! | - | ||||||||||||
3040 | \class QDragMoveEvent | - | ||||||||||||
3041 | \brief The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress. | - | ||||||||||||
3042 | - | |||||||||||||
3043 | \ingroup events | - | ||||||||||||
3044 | \ingroup draganddrop | - | ||||||||||||
3045 | \inmodule QtGui | - | ||||||||||||
3046 | - | |||||||||||||
3047 | A widget will receive drag move events repeatedly while the drag | - | ||||||||||||
3048 | is within its boundaries, if it accepts | - | ||||||||||||
3049 | \l{QWidget::setAcceptDrops()}{drop events} and \l | - | ||||||||||||
3050 | {QWidget::dragEnterEvent()}{enter events}. The widget should | - | ||||||||||||
3051 | examine the event to see what kind of \l{mimeData()}{data} it | - | ||||||||||||
3052 | provides, and call the accept() function to accept the drop if appropriate. | - | ||||||||||||
3053 | - | |||||||||||||
3054 | The rectangle supplied by the answerRect() function can be used to restrict | - | ||||||||||||
3055 | drops to certain parts of the widget. For example, we can check whether the | - | ||||||||||||
3056 | rectangle intersects with the geometry of a certain child widget and only | - | ||||||||||||
3057 | call \l{QDropEvent::acceptProposedAction()}{acceptProposedAction()} if that | - | ||||||||||||
3058 | is the case. | - | ||||||||||||
3059 | - | |||||||||||||
3060 | Note that this class inherits most of its functionality from | - | ||||||||||||
3061 | QDropEvent. | - | ||||||||||||
3062 | - | |||||||||||||
3063 | \sa QDragEnterEvent, QDragLeaveEvent, QDropEvent | - | ||||||||||||
3064 | */ | - | ||||||||||||
3065 | - | |||||||||||||
3066 | /*! | - | ||||||||||||
3067 | \class QDragLeaveEvent | - | ||||||||||||
3068 | \brief The QDragLeaveEvent class provides an event that is sent to a widget when a drag and drop action leaves it. | - | ||||||||||||
3069 | - | |||||||||||||
3070 | \ingroup events | - | ||||||||||||
3071 | \ingroup draganddrop | - | ||||||||||||
3072 | \inmodule QtGui | - | ||||||||||||
3073 | - | |||||||||||||
3074 | This event is always preceded by a QDragEnterEvent and a series | - | ||||||||||||
3075 | of \l{QDragMoveEvent}s. It is not sent if a QDropEvent is sent | - | ||||||||||||
3076 | instead. | - | ||||||||||||
3077 | - | |||||||||||||
3078 | \sa QDragEnterEvent, QDragMoveEvent, QDropEvent | - | ||||||||||||
3079 | */ | - | ||||||||||||
3080 | - | |||||||||||||
3081 | /*! | - | ||||||||||||
3082 | Constructs a QDragLeaveEvent. | - | ||||||||||||
3083 | - | |||||||||||||
3084 | \warning Do not create a QDragLeaveEvent yourself since these | - | ||||||||||||
3085 | objects rely on Qt's internal state. | - | ||||||||||||
3086 | */ | - | ||||||||||||
3087 | QDragLeaveEvent::QDragLeaveEvent() | - | ||||||||||||
3088 | : QEvent(DragLeave) | - | ||||||||||||
3089 | {} never executed: end of block | 0 | ||||||||||||
3090 | - | |||||||||||||
3091 | /*! \internal | - | ||||||||||||
3092 | */ | - | ||||||||||||
3093 | QDragLeaveEvent::~QDragLeaveEvent() | - | ||||||||||||
3094 | { | - | ||||||||||||
3095 | } | - | ||||||||||||
3096 | #endif // QT_NO_DRAGANDDROP | - | ||||||||||||
3097 | - | |||||||||||||
3098 | /*! | - | ||||||||||||
3099 | \class QHelpEvent | - | ||||||||||||
3100 | \brief The QHelpEvent class provides an event that is used to request helpful information | - | ||||||||||||
3101 | about a particular point in a widget. | - | ||||||||||||
3102 | - | |||||||||||||
3103 | \ingroup events | - | ||||||||||||
3104 | \ingroup helpsystem | - | ||||||||||||
3105 | \inmodule QtGui | - | ||||||||||||
3106 | - | |||||||||||||
3107 | This event can be intercepted in applications to provide tooltips | - | ||||||||||||
3108 | or "What's This?" help for custom widgets. The type() can be | - | ||||||||||||
3109 | either QEvent::ToolTip or QEvent::WhatsThis. | - | ||||||||||||
3110 | - | |||||||||||||
3111 | \sa QToolTip, QWhatsThis, QStatusTipEvent, QWhatsThisClickedEvent | - | ||||||||||||
3112 | */ | - | ||||||||||||
3113 | - | |||||||||||||
3114 | /*! | - | ||||||||||||
3115 | Constructs a help event with the given \a type corresponding to the | - | ||||||||||||
3116 | widget-relative position specified by \a pos and the global position | - | ||||||||||||
3117 | specified by \a globalPos. | - | ||||||||||||
3118 | - | |||||||||||||
3119 | \a type must be either QEvent::ToolTip or QEvent::WhatsThis. | - | ||||||||||||
3120 | - | |||||||||||||
3121 | \sa pos(), globalPos() | - | ||||||||||||
3122 | */ | - | ||||||||||||
3123 | QHelpEvent::QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos) | - | ||||||||||||
3124 | : QEvent(type), p(pos), gp(globalPos) | - | ||||||||||||
3125 | {} never executed: end of block | 0 | ||||||||||||
3126 | - | |||||||||||||
3127 | /*! | - | ||||||||||||
3128 | \fn int QHelpEvent::x() const | - | ||||||||||||
3129 | - | |||||||||||||
3130 | Same as pos().x(). | - | ||||||||||||
3131 | - | |||||||||||||
3132 | \sa y(), pos(), globalPos() | - | ||||||||||||
3133 | */ | - | ||||||||||||
3134 | - | |||||||||||||
3135 | /*! | - | ||||||||||||
3136 | \fn int QHelpEvent::y() const | - | ||||||||||||
3137 | - | |||||||||||||
3138 | Same as pos().y(). | - | ||||||||||||
3139 | - | |||||||||||||
3140 | \sa x(), pos(), globalPos() | - | ||||||||||||
3141 | */ | - | ||||||||||||
3142 | - | |||||||||||||
3143 | /*! | - | ||||||||||||
3144 | \fn int QHelpEvent::globalX() const | - | ||||||||||||
3145 | - | |||||||||||||
3146 | Same as globalPos().x(). | - | ||||||||||||
3147 | - | |||||||||||||
3148 | \sa x(), globalY(), globalPos() | - | ||||||||||||
3149 | */ | - | ||||||||||||
3150 | - | |||||||||||||
3151 | /*! | - | ||||||||||||
3152 | \fn int QHelpEvent::globalY() const | - | ||||||||||||
3153 | - | |||||||||||||
3154 | Same as globalPos().y(). | - | ||||||||||||
3155 | - | |||||||||||||
3156 | \sa y(), globalX(), globalPos() | - | ||||||||||||
3157 | */ | - | ||||||||||||
3158 | - | |||||||||||||
3159 | /*! | - | ||||||||||||
3160 | \fn const QPoint &QHelpEvent::pos() const | - | ||||||||||||
3161 | - | |||||||||||||
3162 | Returns the mouse cursor position when the event was generated, | - | ||||||||||||
3163 | relative to the widget to which the event is dispatched. | - | ||||||||||||
3164 | - | |||||||||||||
3165 | \sa globalPos(), x(), y() | - | ||||||||||||
3166 | */ | - | ||||||||||||
3167 | - | |||||||||||||
3168 | /*! | - | ||||||||||||
3169 | \fn const QPoint &QHelpEvent::globalPos() const | - | ||||||||||||
3170 | - | |||||||||||||
3171 | Returns the mouse cursor position when the event was generated | - | ||||||||||||
3172 | in global coordinates. | - | ||||||||||||
3173 | - | |||||||||||||
3174 | \sa pos(), globalX(), globalY() | - | ||||||||||||
3175 | */ | - | ||||||||||||
3176 | - | |||||||||||||
3177 | /*! \internal | - | ||||||||||||
3178 | */ | - | ||||||||||||
3179 | QHelpEvent::~QHelpEvent() | - | ||||||||||||
3180 | { | - | ||||||||||||
3181 | } | - | ||||||||||||
3182 | - | |||||||||||||
3183 | #ifndef QT_NO_STATUSTIP | - | ||||||||||||
3184 | - | |||||||||||||
3185 | /*! | - | ||||||||||||
3186 | \class QStatusTipEvent | - | ||||||||||||
3187 | \brief The QStatusTipEvent class provides an event that is used to show messages in a status bar. | - | ||||||||||||
3188 | - | |||||||||||||
3189 | \ingroup events | - | ||||||||||||
3190 | \ingroup helpsystem | - | ||||||||||||
3191 | \inmodule QtGui | - | ||||||||||||
3192 | - | |||||||||||||
3193 | Status tips can be set on a widget using the | - | ||||||||||||
3194 | QWidget::setStatusTip() function. They are shown in the status | - | ||||||||||||
3195 | bar when the mouse cursor enters the widget. For example: | - | ||||||||||||
3196 | - | |||||||||||||
3197 | \table 100% | - | ||||||||||||
3198 | \row | - | ||||||||||||
3199 | \li | - | ||||||||||||
3200 | \snippet qstatustipevent/main.cpp 1 | - | ||||||||||||
3201 | \dots | - | ||||||||||||
3202 | \snippet qstatustipevent/main.cpp 3 | - | ||||||||||||
3203 | \li | - | ||||||||||||
3204 | \image qstatustipevent-widget.png Widget with status tip. | - | ||||||||||||
3205 | \endtable | - | ||||||||||||
3206 | - | |||||||||||||
3207 | Status tips can also be set on actions using the | - | ||||||||||||
3208 | QAction::setStatusTip() function: | - | ||||||||||||
3209 | - | |||||||||||||
3210 | \table 100% | - | ||||||||||||
3211 | \row | - | ||||||||||||
3212 | \li | - | ||||||||||||
3213 | \snippet qstatustipevent/main.cpp 0 | - | ||||||||||||
3214 | \snippet qstatustipevent/main.cpp 2 | - | ||||||||||||
3215 | \dots | - | ||||||||||||
3216 | \snippet qstatustipevent/main.cpp 3 | - | ||||||||||||
3217 | \li | - | ||||||||||||
3218 | \image qstatustipevent-action.png Action with status tip. | - | ||||||||||||
3219 | \endtable | - | ||||||||||||
3220 | - | |||||||||||||
3221 | Finally, status tips are supported for the item view classes | - | ||||||||||||
3222 | through the Qt::StatusTipRole enum value. | - | ||||||||||||
3223 | - | |||||||||||||
3224 | \sa QStatusBar, QHelpEvent, QWhatsThisClickedEvent | - | ||||||||||||
3225 | */ | - | ||||||||||||
3226 | - | |||||||||||||
3227 | /*! | - | ||||||||||||
3228 | Constructs a status tip event with the text specified by \a tip. | - | ||||||||||||
3229 | - | |||||||||||||
3230 | \sa tip() | - | ||||||||||||
3231 | */ | - | ||||||||||||
3232 | QStatusTipEvent::QStatusTipEvent(const QString &tip) | - | ||||||||||||
3233 | : QEvent(StatusTip), s(tip) | - | ||||||||||||
3234 | {} never executed: end of block | 0 | ||||||||||||
3235 | - | |||||||||||||
3236 | /*! \internal | - | ||||||||||||
3237 | */ | - | ||||||||||||
3238 | QStatusTipEvent::~QStatusTipEvent() | - | ||||||||||||
3239 | { | - | ||||||||||||
3240 | } | - | ||||||||||||
3241 | - | |||||||||||||
3242 | /*! | - | ||||||||||||
3243 | \fn QString QStatusTipEvent::tip() const | - | ||||||||||||
3244 | - | |||||||||||||
3245 | Returns the message to show in the status bar. | - | ||||||||||||
3246 | - | |||||||||||||
3247 | \sa QStatusBar::showMessage() | - | ||||||||||||
3248 | */ | - | ||||||||||||
3249 | - | |||||||||||||
3250 | #endif // QT_NO_STATUSTIP | - | ||||||||||||
3251 | - | |||||||||||||
3252 | #ifndef QT_NO_WHATSTHIS | - | ||||||||||||
3253 | - | |||||||||||||
3254 | /*! | - | ||||||||||||
3255 | \class QWhatsThisClickedEvent | - | ||||||||||||
3256 | \brief The QWhatsThisClickedEvent class provides an event that | - | ||||||||||||
3257 | can be used to handle hyperlinks in a "What's This?" text. | - | ||||||||||||
3258 | - | |||||||||||||
3259 | \ingroup events | - | ||||||||||||
3260 | \ingroup helpsystem | - | ||||||||||||
3261 | \inmodule QtGui | - | ||||||||||||
3262 | - | |||||||||||||
3263 | \sa QWhatsThis, QHelpEvent, QStatusTipEvent | - | ||||||||||||
3264 | */ | - | ||||||||||||
3265 | - | |||||||||||||
3266 | /*! | - | ||||||||||||
3267 | Constructs an event containing a URL specified by \a href when a link | - | ||||||||||||
3268 | is clicked in a "What's This?" message. | - | ||||||||||||
3269 | - | |||||||||||||
3270 | \sa href() | - | ||||||||||||
3271 | */ | - | ||||||||||||
3272 | QWhatsThisClickedEvent::QWhatsThisClickedEvent(const QString &href) | - | ||||||||||||
3273 | : QEvent(WhatsThisClicked), s(href) | - | ||||||||||||
3274 | {} never executed: end of block | 0 | ||||||||||||
3275 | - | |||||||||||||
3276 | /*! \internal | - | ||||||||||||
3277 | */ | - | ||||||||||||
3278 | QWhatsThisClickedEvent::~QWhatsThisClickedEvent() | - | ||||||||||||
3279 | { | - | ||||||||||||
3280 | } | - | ||||||||||||
3281 | - | |||||||||||||
3282 | /*! | - | ||||||||||||
3283 | \fn QString QWhatsThisClickedEvent::href() const | - | ||||||||||||
3284 | - | |||||||||||||
3285 | Returns the URL that was clicked by the user in the "What's | - | ||||||||||||
3286 | This?" text. | - | ||||||||||||
3287 | */ | - | ||||||||||||
3288 | - | |||||||||||||
3289 | #endif // QT_NO_WHATSTHIS | - | ||||||||||||
3290 | - | |||||||||||||
3291 | #ifndef QT_NO_ACTION | - | ||||||||||||
3292 | - | |||||||||||||
3293 | /*! | - | ||||||||||||
3294 | \class QActionEvent | - | ||||||||||||
3295 | \brief The QActionEvent class provides an event that is generated | - | ||||||||||||
3296 | when a QAction is added, removed, or changed. | - | ||||||||||||
3297 | - | |||||||||||||
3298 | \ingroup events | - | ||||||||||||
3299 | \inmodule QtGui | - | ||||||||||||
3300 | - | |||||||||||||
3301 | Actions can be added to widgets using QWidget::addAction(). This | - | ||||||||||||
3302 | generates an \l ActionAdded event, which you can handle to provide | - | ||||||||||||
3303 | custom behavior. For example, QToolBar reimplements | - | ||||||||||||
3304 | QWidget::actionEvent() to create \l{QToolButton}s for the | - | ||||||||||||
3305 | actions. | - | ||||||||||||
3306 | - | |||||||||||||
3307 | \sa QAction, QWidget::addAction(), QWidget::removeAction(), QWidget::actions() | - | ||||||||||||
3308 | */ | - | ||||||||||||
3309 | - | |||||||||||||
3310 | /*! | - | ||||||||||||
3311 | Constructs an action event. The \a type can be \l ActionChanged, | - | ||||||||||||
3312 | \l ActionAdded, or \l ActionRemoved. | - | ||||||||||||
3313 | - | |||||||||||||
3314 | \a action is the action that is changed, added, or removed. If \a | - | ||||||||||||
3315 | type is ActionAdded, the action is to be inserted before the | - | ||||||||||||
3316 | action \a before. If \a before is 0, the action is appended. | - | ||||||||||||
3317 | */ | - | ||||||||||||
3318 | QActionEvent::QActionEvent(int type, QAction *action, QAction *before) | - | ||||||||||||
3319 | : QEvent(static_cast<QEvent::Type>(type)), act(action), bef(before) | - | ||||||||||||
3320 | {} never executed: end of block | 0 | ||||||||||||
3321 | - | |||||||||||||
3322 | /*! \internal | - | ||||||||||||
3323 | */ | - | ||||||||||||
3324 | QActionEvent::~QActionEvent() | - | ||||||||||||
3325 | { | - | ||||||||||||
3326 | } | - | ||||||||||||
3327 | - | |||||||||||||
3328 | /*! | - | ||||||||||||
3329 | \fn QAction *QActionEvent::action() const | - | ||||||||||||
3330 | - | |||||||||||||
3331 | Returns the action that is changed, added, or removed. | - | ||||||||||||
3332 | - | |||||||||||||
3333 | \sa before() | - | ||||||||||||
3334 | */ | - | ||||||||||||
3335 | - | |||||||||||||
3336 | /*! | - | ||||||||||||
3337 | \fn QAction *QActionEvent::before() const | - | ||||||||||||
3338 | - | |||||||||||||
3339 | If type() is \l ActionAdded, returns the action that should | - | ||||||||||||
3340 | appear before action(). If this function returns 0, the action | - | ||||||||||||
3341 | should be appended to already existing actions on the same | - | ||||||||||||
3342 | widget. | - | ||||||||||||
3343 | - | |||||||||||||
3344 | \sa action(), QWidget::actions() | - | ||||||||||||
3345 | */ | - | ||||||||||||
3346 | - | |||||||||||||
3347 | #endif // QT_NO_ACTION | - | ||||||||||||
3348 | - | |||||||||||||
3349 | /*! | - | ||||||||||||
3350 | \class QHideEvent | - | ||||||||||||
3351 | \brief The QHideEvent class provides an event which is sent after a widget is hidden. | - | ||||||||||||
3352 | - | |||||||||||||
3353 | \ingroup events | - | ||||||||||||
3354 | \inmodule QtGui | - | ||||||||||||
3355 | - | |||||||||||||
3356 | This event is sent just before QWidget::hide() returns, and also | - | ||||||||||||
3357 | when a top-level window has been hidden (iconified) by the user. | - | ||||||||||||
3358 | - | |||||||||||||
3359 | If spontaneous() is true, the event originated outside the | - | ||||||||||||
3360 | application. In this case, the user hid the window using the | - | ||||||||||||
3361 | window manager controls, either by iconifying the window or by | - | ||||||||||||
3362 | switching to another virtual desktop where the window is not | - | ||||||||||||
3363 | visible. The window will become hidden but not withdrawn. If the | - | ||||||||||||
3364 | window was iconified, QWidget::isMinimized() returns \c true. | - | ||||||||||||
3365 | - | |||||||||||||
3366 | \sa QShowEvent | - | ||||||||||||
3367 | */ | - | ||||||||||||
3368 | - | |||||||||||||
3369 | /*! | - | ||||||||||||
3370 | Constructs a QHideEvent. | - | ||||||||||||
3371 | */ | - | ||||||||||||
3372 | QHideEvent::QHideEvent() | - | ||||||||||||
3373 | : QEvent(Hide) | - | ||||||||||||
3374 | {} never executed: end of block | 0 | ||||||||||||
3375 | - | |||||||||||||
3376 | /*! \internal | - | ||||||||||||
3377 | */ | - | ||||||||||||
3378 | QHideEvent::~QHideEvent() | - | ||||||||||||
3379 | { | - | ||||||||||||
3380 | } | - | ||||||||||||
3381 | - | |||||||||||||
3382 | /*! | - | ||||||||||||
3383 | \class QShowEvent | - | ||||||||||||
3384 | \brief The QShowEvent class provides an event that is sent when a widget is shown. | - | ||||||||||||
3385 | - | |||||||||||||
3386 | \ingroup events | - | ||||||||||||
3387 | \inmodule QtGui | - | ||||||||||||
3388 | - | |||||||||||||
3389 | There are two kinds of show events: show events caused by the | - | ||||||||||||
3390 | window system (spontaneous), and internal show events. Spontaneous (QEvent::spontaneous()) | - | ||||||||||||
3391 | show events are sent just after the window system shows the | - | ||||||||||||
3392 | window; they are also sent when a top-level window is redisplayed | - | ||||||||||||
3393 | after being iconified. Internal show events are delivered just | - | ||||||||||||
3394 | before the widget becomes visible. | - | ||||||||||||
3395 | - | |||||||||||||
3396 | \sa QHideEvent | - | ||||||||||||
3397 | */ | - | ||||||||||||
3398 | - | |||||||||||||
3399 | /*! | - | ||||||||||||
3400 | Constructs a QShowEvent. | - | ||||||||||||
3401 | */ | - | ||||||||||||
3402 | QShowEvent::QShowEvent() | - | ||||||||||||
3403 | : QEvent(Show) | - | ||||||||||||
3404 | {} never executed: end of block | 0 | ||||||||||||
3405 | - | |||||||||||||
3406 | /*! \internal | - | ||||||||||||
3407 | */ | - | ||||||||||||
3408 | QShowEvent::~QShowEvent() | - | ||||||||||||
3409 | { | - | ||||||||||||
3410 | } | - | ||||||||||||
3411 | - | |||||||||||||
3412 | /*! | - | ||||||||||||
3413 | \class QFileOpenEvent | - | ||||||||||||
3414 | \brief The QFileOpenEvent class provides an event that will be | - | ||||||||||||
3415 | sent when there is a request to open a file or a URL. | - | ||||||||||||
3416 | - | |||||||||||||
3417 | \ingroup events | - | ||||||||||||
3418 | \inmodule QtGui | - | ||||||||||||
3419 | - | |||||||||||||
3420 | File open events will be sent to the QApplication::instance() | - | ||||||||||||
3421 | when the operating system requests that a file or URL should be opened. | - | ||||||||||||
3422 | This is a high-level event that can be caused by different user actions | - | ||||||||||||
3423 | depending on the user's desktop environment; for example, double | - | ||||||||||||
3424 | clicking on an file icon in the Finder on \macos. | - | ||||||||||||
3425 | - | |||||||||||||
3426 | This event is only used to notify the application of a request. | - | ||||||||||||
3427 | It may be safely ignored. | - | ||||||||||||
3428 | - | |||||||||||||
3429 | \note This class is currently supported for \macos only. | - | ||||||||||||
3430 | - | |||||||||||||
3431 | \section1 \macos Example | - | ||||||||||||
3432 | - | |||||||||||||
3433 | In order to trigger the event on \macos, the application must be configured | - | ||||||||||||
3434 | to let the OS know what kind of file(s) it should react on. | - | ||||||||||||
3435 | - | |||||||||||||
3436 | For example, the following \c Info.plist file declares that the application | - | ||||||||||||
3437 | can act as a viewer for files with a PNG extension: | - | ||||||||||||
3438 | - | |||||||||||||
3439 | \snippet qfileopenevent/Info.plist Custom Info.plist | - | ||||||||||||
3440 | - | |||||||||||||
3441 | The following implementation of a QApplication subclass prints the path to | - | ||||||||||||
3442 | the file that was, for example, dropped on the Dock icon of the application. | - | ||||||||||||
3443 | - | |||||||||||||
3444 | \snippet qfileopenevent/main.cpp QApplication subclass | - | ||||||||||||
3445 | */ | - | ||||||||||||
3446 | - | |||||||||||||
3447 | /*! | - | ||||||||||||
3448 | \internal | - | ||||||||||||
3449 | - | |||||||||||||
3450 | Constructs a file open event for the given \a file. | - | ||||||||||||
3451 | */ | - | ||||||||||||
3452 | QFileOpenEvent::QFileOpenEvent(const QString &file) | - | ||||||||||||
3453 | : QEvent(FileOpen), f(file), m_url(QUrl::fromLocalFile(file)) | - | ||||||||||||
3454 | { | - | ||||||||||||
3455 | } never executed: end of block | 0 | ||||||||||||
3456 | - | |||||||||||||
3457 | /*! | - | ||||||||||||
3458 | \internal | - | ||||||||||||
3459 | - | |||||||||||||
3460 | Constructs a file open event for the given \a url. | - | ||||||||||||
3461 | */ | - | ||||||||||||
3462 | QFileOpenEvent::QFileOpenEvent(const QUrl &url) | - | ||||||||||||
3463 | : QEvent(FileOpen), f(url.toLocalFile()), m_url(url) | - | ||||||||||||
3464 | { | - | ||||||||||||
3465 | } never executed: end of block | 0 | ||||||||||||
3466 | - | |||||||||||||
3467 | - | |||||||||||||
3468 | /*! \internal | - | ||||||||||||
3469 | */ | - | ||||||||||||
3470 | QFileOpenEvent::~QFileOpenEvent() | - | ||||||||||||
3471 | { | - | ||||||||||||
3472 | } | - | ||||||||||||
3473 | - | |||||||||||||
3474 | /*! | - | ||||||||||||
3475 | \fn QString QFileOpenEvent::file() const | - | ||||||||||||
3476 | - | |||||||||||||
3477 | Returns the file that is being opened. | - | ||||||||||||
3478 | */ | - | ||||||||||||
3479 | - | |||||||||||||
3480 | /*! | - | ||||||||||||
3481 | \fn QUrl QFileOpenEvent::url() const | - | ||||||||||||
3482 | - | |||||||||||||
3483 | Returns the url that is being opened. | - | ||||||||||||
3484 | - | |||||||||||||
3485 | \since 4.6 | - | ||||||||||||
3486 | */ | - | ||||||||||||
3487 | - | |||||||||||||
3488 | /*! | - | ||||||||||||
3489 | \fn bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const | - | ||||||||||||
3490 | - | |||||||||||||
3491 | Opens a QFile on the \a file referenced by this event in the mode specified | - | ||||||||||||
3492 | by \a flags. Returns \c true if successful; otherwise returns \c false. | - | ||||||||||||
3493 | - | |||||||||||||
3494 | This is necessary as some files cannot be opened by name, but require specific | - | ||||||||||||
3495 | information stored in this event. | - | ||||||||||||
3496 | - | |||||||||||||
3497 | \since 4.8 | - | ||||||||||||
3498 | */ | - | ||||||||||||
3499 | bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const | - | ||||||||||||
3500 | { | - | ||||||||||||
3501 | file.setFileName(f); | - | ||||||||||||
3502 | return file.open(flags); never executed: return file.open(flags); | 0 | ||||||||||||
3503 | } | - | ||||||||||||
3504 | - | |||||||||||||
3505 | #ifndef QT_NO_TOOLBAR | - | ||||||||||||
3506 | /*! | - | ||||||||||||
3507 | \internal | - | ||||||||||||
3508 | \class QToolBarChangeEvent | - | ||||||||||||
3509 | \brief The QToolBarChangeEvent class provides an event that is | - | ||||||||||||
3510 | sent whenever a the toolbar button is clicked on \macos. | - | ||||||||||||
3511 | - | |||||||||||||
3512 | \ingroup events | - | ||||||||||||
3513 | \inmodule QtGui | - | ||||||||||||
3514 | - | |||||||||||||
3515 | The QToolBarChangeEvent is sent when the toolbar button is clicked. On | - | ||||||||||||
3516 | \macos, this is the long oblong button on the right side of the window | - | ||||||||||||
3517 | title bar. The default implementation is to toggle the appearance (hidden or | - | ||||||||||||
3518 | shown) of the associated toolbars for the window. | - | ||||||||||||
3519 | */ | - | ||||||||||||
3520 | - | |||||||||||||
3521 | /*! | - | ||||||||||||
3522 | \internal | - | ||||||||||||
3523 | - | |||||||||||||
3524 | Construct a QToolBarChangeEvent given the current button state in \a state. | - | ||||||||||||
3525 | */ | - | ||||||||||||
3526 | QToolBarChangeEvent::QToolBarChangeEvent(bool t) | - | ||||||||||||
3527 | : QEvent(ToolBarChange), tog(t) | - | ||||||||||||
3528 | {} never executed: end of block | 0 | ||||||||||||
3529 | - | |||||||||||||
3530 | /*! \internal | - | ||||||||||||
3531 | */ | - | ||||||||||||
3532 | QToolBarChangeEvent::~QToolBarChangeEvent() | - | ||||||||||||
3533 | { | - | ||||||||||||
3534 | } | - | ||||||||||||
3535 | - | |||||||||||||
3536 | /*! | - | ||||||||||||
3537 | \fn bool QToolBarChangeEvent::toggle() const | - | ||||||||||||
3538 | \internal | - | ||||||||||||
3539 | */ | - | ||||||||||||
3540 | - | |||||||||||||
3541 | /* | - | ||||||||||||
3542 | \fn Qt::ButtonState QToolBarChangeEvent::state() const | - | ||||||||||||
3543 | - | |||||||||||||
3544 | Returns the keyboard modifier flags at the time of the event. | - | ||||||||||||
3545 | - | |||||||||||||
3546 | The returned value is a selection of the following values, | - | ||||||||||||
3547 | combined using the OR operator: | - | ||||||||||||
3548 | Qt::ShiftButton, Qt::ControlButton, Qt::MetaButton, and Qt::AltButton. | - | ||||||||||||
3549 | */ | - | ||||||||||||
3550 | - | |||||||||||||
3551 | #endif // QT_NO_TOOLBAR | - | ||||||||||||
3552 | - | |||||||||||||
3553 | #ifndef QT_NO_SHORTCUT | - | ||||||||||||
3554 | - | |||||||||||||
3555 | /*! | - | ||||||||||||
3556 | Constructs a shortcut event for the given \a key press, | - | ||||||||||||
3557 | associated with the QShortcut ID \a id. | - | ||||||||||||
3558 | - | |||||||||||||
3559 | \a ambiguous specifies whether there is more than one QShortcut | - | ||||||||||||
3560 | for the same key sequence. | - | ||||||||||||
3561 | */ | - | ||||||||||||
3562 | QShortcutEvent::QShortcutEvent(const QKeySequence &key, int id, bool ambiguous) | - | ||||||||||||
3563 | : QEvent(Shortcut), sequence(key), ambig(ambiguous), sid(id) | - | ||||||||||||
3564 | { | - | ||||||||||||
3565 | } never executed: end of block | 0 | ||||||||||||
3566 | - | |||||||||||||
3567 | /*! | - | ||||||||||||
3568 | Destroys the event object. | - | ||||||||||||
3569 | */ | - | ||||||||||||
3570 | QShortcutEvent::~QShortcutEvent() | - | ||||||||||||
3571 | { | - | ||||||||||||
3572 | } | - | ||||||||||||
3573 | - | |||||||||||||
3574 | #endif // QT_NO_SHORTCUT | - | ||||||||||||
3575 | - | |||||||||||||
3576 | #ifndef QT_NO_DEBUG_STREAM | - | ||||||||||||
3577 | - | |||||||||||||
3578 | static inline void formatTouchEvent(QDebug d, const QTouchEvent &t) | - | ||||||||||||
3579 | { | - | ||||||||||||
3580 | d << "QTouchEvent("; | - | ||||||||||||
3581 | QtDebugUtils::formatQEnum(d, t.type()); | - | ||||||||||||
3582 | d << " device: " << t.device()->name(); | - | ||||||||||||
3583 | d << " states: "; | - | ||||||||||||
3584 | QtDebugUtils::formatQFlags(d, t.touchPointStates()); | - | ||||||||||||
3585 | d << ", " << t.touchPoints().size() << " points: " << t.touchPoints() << ')'; | - | ||||||||||||
3586 | } never executed: end of block | 0 | ||||||||||||
3587 | - | |||||||||||||
3588 | static void formatUnicodeString(QDebug d, const QString &s) | - | ||||||||||||
3589 | { | - | ||||||||||||
3590 | d << '"' << hex; | - | ||||||||||||
3591 | for (int i = 0; i < s.size(); ++i) {
| 0 | ||||||||||||
3592 | if (i)
| 0 | ||||||||||||
3593 | d << ','; never executed: d << ','; | 0 | ||||||||||||
3594 | d << "U+" << s.at(i).unicode(); | - | ||||||||||||
3595 | } never executed: end of block | 0 | ||||||||||||
3596 | d << dec << '"'; | - | ||||||||||||
3597 | } never executed: end of block | 0 | ||||||||||||
3598 | - | |||||||||||||
3599 | static inline void formatInputMethodEvent(QDebug d, const QInputMethodEvent *e) | - | ||||||||||||
3600 | { | - | ||||||||||||
3601 | d << "QInputMethodEvent("; | - | ||||||||||||
3602 | if (!e->preeditString().isEmpty()) {
| 0 | ||||||||||||
3603 | d << "preedit="; | - | ||||||||||||
3604 | formatUnicodeString(d, e->preeditString()); | - | ||||||||||||
3605 | } never executed: end of block | 0 | ||||||||||||
3606 | if (!e->commitString().isEmpty()) {
| 0 | ||||||||||||
3607 | d << ", commit="; | - | ||||||||||||
3608 | formatUnicodeString(d, e->commitString()); | - | ||||||||||||
3609 | } never executed: end of block | 0 | ||||||||||||
3610 | if (e->replacementLength()) {
| 0 | ||||||||||||
3611 | d << ", replacementStart=" << e->replacementStart() << ", replacementLength=" | - | ||||||||||||
3612 | << e->replacementLength(); | - | ||||||||||||
3613 | } never executed: end of block | 0 | ||||||||||||
3614 | if (const int attributeCount = e->attributes().size()) {
| 0 | ||||||||||||
3615 | d << ", attributes= {"; | - | ||||||||||||
3616 | for (int a = 0; a < attributeCount; ++a) {
| 0 | ||||||||||||
3617 | const QInputMethodEvent::Attribute &at = e->attributes().at(a); | - | ||||||||||||
3618 | if (a)
| 0 | ||||||||||||
3619 | d << ','; never executed: d << ','; | 0 | ||||||||||||
3620 | d << "[type= " << at.type << ", start=" << at.start << ", length=" << at.length | - | ||||||||||||
3621 | << ", value=" << at.value << ']'; | - | ||||||||||||
3622 | } never executed: end of block | 0 | ||||||||||||
3623 | d << '}'; | - | ||||||||||||
3624 | } never executed: end of block | 0 | ||||||||||||
3625 | d << ')'; | - | ||||||||||||
3626 | } never executed: end of block | 0 | ||||||||||||
3627 | - | |||||||||||||
3628 | static inline void formatInputMethodQueryEvent(QDebug d, const QInputMethodQueryEvent *e) | - | ||||||||||||
3629 | { | - | ||||||||||||
3630 | const Qt::InputMethodQueries queries = e->queries(); | - | ||||||||||||
3631 | d << "QInputMethodQueryEvent(queries=" << showbase << hex << int(queries) | - | ||||||||||||
3632 | << noshowbase << dec << ", {"; | - | ||||||||||||
3633 | for (unsigned mask = 1; mask <= Qt::ImTextAfterCursor; mask<<=1) {
| 0 | ||||||||||||
3634 | if (queries & mask) {
| 0 | ||||||||||||
3635 | const QVariant value = e->value(static_cast<Qt::InputMethodQuery>(mask)); | - | ||||||||||||
3636 | if (value.isValid())
| 0 | ||||||||||||
3637 | d << '[' << showbase << hex << mask << noshowbase << dec << '=' << value << "],"; never executed: d << '[' << showbase << hex << mask << noshowbase << dec << '=' << value << "],"; | 0 | ||||||||||||
3638 | } never executed: end of block | 0 | ||||||||||||
3639 | } never executed: end of block | 0 | ||||||||||||
3640 | d << "})"; | - | ||||||||||||
3641 | } never executed: end of block | 0 | ||||||||||||
3642 | - | |||||||||||||
3643 | static const char *eventClassName(QEvent::Type t) | - | ||||||||||||
3644 | { | - | ||||||||||||
3645 | switch (t) { | - | ||||||||||||
3646 | case QEvent::ActionAdded: never executed: case QEvent::ActionAdded: | 0 | ||||||||||||
3647 | case QEvent::ActionRemoved: never executed: case QEvent::ActionRemoved: | 0 | ||||||||||||
3648 | case QEvent::ActionChanged: never executed: case QEvent::ActionChanged: | 0 | ||||||||||||
3649 | return "QActionEvent"; never executed: return "QActionEvent"; | 0 | ||||||||||||
3650 | case QEvent::MouseButtonPress: never executed: case QEvent::MouseButtonPress: | 0 | ||||||||||||
3651 | case QEvent::MouseButtonRelease: never executed: case QEvent::MouseButtonRelease: | 0 | ||||||||||||
3652 | case QEvent::MouseButtonDblClick: never executed: case QEvent::MouseButtonDblClick: | 0 | ||||||||||||
3653 | case QEvent::MouseMove: never executed: case QEvent::MouseMove: | 0 | ||||||||||||
3654 | case QEvent::NonClientAreaMouseMove: never executed: case QEvent::NonClientAreaMouseMove: | 0 | ||||||||||||
3655 | case QEvent::NonClientAreaMouseButtonPress: never executed: case QEvent::NonClientAreaMouseButtonPress: | 0 | ||||||||||||
3656 | case QEvent::NonClientAreaMouseButtonRelease: never executed: case QEvent::NonClientAreaMouseButtonRelease: | 0 | ||||||||||||
3657 | case QEvent::NonClientAreaMouseButtonDblClick: never executed: case QEvent::NonClientAreaMouseButtonDblClick: | 0 | ||||||||||||
3658 | return "QMouseEvent"; never executed: return "QMouseEvent"; | 0 | ||||||||||||
3659 | case QEvent::DragEnter: never executed: case QEvent::DragEnter: | 0 | ||||||||||||
3660 | return "QDragEnterEvent"; never executed: return "QDragEnterEvent"; | 0 | ||||||||||||
3661 | case QEvent::DragMove: never executed: case QEvent::DragMove: | 0 | ||||||||||||
3662 | return "QDragMoveEvent"; never executed: return "QDragMoveEvent"; | 0 | ||||||||||||
3663 | case QEvent::Drop: never executed: case QEvent::Drop: | 0 | ||||||||||||
3664 | return "QDropEvent"; never executed: return "QDropEvent"; | 0 | ||||||||||||
3665 | case QEvent::KeyPress: never executed: case QEvent::KeyPress: | 0 | ||||||||||||
3666 | case QEvent::KeyRelease: never executed: case QEvent::KeyRelease: | 0 | ||||||||||||
3667 | case QEvent::ShortcutOverride: never executed: case QEvent::ShortcutOverride: | 0 | ||||||||||||
3668 | return "QKeyEvent"; never executed: return "QKeyEvent"; | 0 | ||||||||||||
3669 | case QEvent::FocusIn: never executed: case QEvent::FocusIn: | 0 | ||||||||||||
3670 | case QEvent::FocusOut: never executed: case QEvent::FocusOut: | 0 | ||||||||||||
3671 | case QEvent::FocusAboutToChange: never executed: case QEvent::FocusAboutToChange: | 0 | ||||||||||||
3672 | return "QFocusEvent"; never executed: return "QFocusEvent"; | 0 | ||||||||||||
3673 | case QEvent::ChildAdded: never executed: case QEvent::ChildAdded: | 0 | ||||||||||||
3674 | case QEvent::ChildPolished: never executed: case QEvent::ChildPolished: | 0 | ||||||||||||
3675 | case QEvent::ChildRemoved: never executed: case QEvent::ChildRemoved: | 0 | ||||||||||||
3676 | return "QChildEvent"; never executed: return "QChildEvent"; | 0 | ||||||||||||
3677 | case QEvent::Paint: never executed: case QEvent::Paint: | 0 | ||||||||||||
3678 | return "QPaintEvent"; never executed: return "QPaintEvent"; | 0 | ||||||||||||
3679 | case QEvent::Move: never executed: case QEvent::Move: | 0 | ||||||||||||
3680 | return "QMoveEvent"; never executed: return "QMoveEvent"; | 0 | ||||||||||||
3681 | case QEvent::Resize: never executed: case QEvent::Resize: | 0 | ||||||||||||
3682 | return "QResizeEvent"; never executed: return "QResizeEvent"; | 0 | ||||||||||||
3683 | case QEvent::Show: never executed: case QEvent::Show: | 0 | ||||||||||||
3684 | return "QShowEvent"; never executed: return "QShowEvent"; | 0 | ||||||||||||
3685 | case QEvent::Hide: never executed: case QEvent::Hide: | 0 | ||||||||||||
3686 | return "QHideEvent"; never executed: return "QHideEvent"; | 0 | ||||||||||||
3687 | case QEvent::Enter: never executed: case QEvent::Enter: | 0 | ||||||||||||
3688 | return "QEnterEvent"; never executed: return "QEnterEvent"; | 0 | ||||||||||||
3689 | case QEvent::Close: never executed: case QEvent::Close: | 0 | ||||||||||||
3690 | return "QCloseEvent"; never executed: return "QCloseEvent"; | 0 | ||||||||||||
3691 | case QEvent::FileOpen: never executed: case QEvent::FileOpen: | 0 | ||||||||||||
3692 | return "QFileOpenEvent"; never executed: return "QFileOpenEvent"; | 0 | ||||||||||||
3693 | #ifndef QT_NO_GESTURES | - | ||||||||||||
3694 | case QEvent::NativeGesture: never executed: case QEvent::NativeGesture: | 0 | ||||||||||||
3695 | return "QNativeGestureEvent"; never executed: return "QNativeGestureEvent"; | 0 | ||||||||||||
3696 | case QEvent::Gesture: never executed: case QEvent::Gesture: | 0 | ||||||||||||
3697 | case QEvent::GestureOverride: never executed: case QEvent::GestureOverride: | 0 | ||||||||||||
3698 | return "QGestureEvent"; never executed: return "QGestureEvent"; | 0 | ||||||||||||
3699 | #endif | - | ||||||||||||
3700 | case QEvent::HoverEnter: never executed: case QEvent::HoverEnter: | 0 | ||||||||||||
3701 | case QEvent::HoverLeave: never executed: case QEvent::HoverLeave: | 0 | ||||||||||||
3702 | case QEvent::HoverMove: never executed: case QEvent::HoverMove: | 0 | ||||||||||||
3703 | return "QHoverEvent"; never executed: return "QHoverEvent"; | 0 | ||||||||||||
3704 | case QEvent::TabletEnterProximity: never executed: case QEvent::TabletEnterProximity: | 0 | ||||||||||||
3705 | case QEvent::TabletLeaveProximity: never executed: case QEvent::TabletLeaveProximity: | 0 | ||||||||||||
3706 | case QEvent::TabletPress: never executed: case QEvent::TabletPress: | 0 | ||||||||||||
3707 | case QEvent::TabletMove: never executed: case QEvent::TabletMove: | 0 | ||||||||||||
3708 | case QEvent::TabletRelease: never executed: case QEvent::TabletRelease: | 0 | ||||||||||||
3709 | return "QTabletEvent"; never executed: return "QTabletEvent"; | 0 | ||||||||||||
3710 | case QEvent::StatusTip: never executed: case QEvent::StatusTip: | 0 | ||||||||||||
3711 | return "QStatusTipEvent"; never executed: return "QStatusTipEvent"; | 0 | ||||||||||||
3712 | case QEvent::ToolTip: never executed: case QEvent::ToolTip: | 0 | ||||||||||||
3713 | return "QHelpEvent"; never executed: return "QHelpEvent"; | 0 | ||||||||||||
3714 | case QEvent::WindowStateChange: never executed: case QEvent::WindowStateChange: | 0 | ||||||||||||
3715 | return "QWindowStateChangeEvent"; never executed: return "QWindowStateChangeEvent"; | 0 | ||||||||||||
3716 | case QEvent::Wheel: never executed: case QEvent::Wheel: | 0 | ||||||||||||
3717 | return "QWheelEvent"; never executed: return "QWheelEvent"; | 0 | ||||||||||||
3718 | case QEvent::TouchBegin: never executed: case QEvent::TouchBegin: | 0 | ||||||||||||
3719 | case QEvent::TouchUpdate: never executed: case QEvent::TouchUpdate: | 0 | ||||||||||||
3720 | case QEvent::TouchEnd: never executed: case QEvent::TouchEnd: | 0 | ||||||||||||
3721 | return "QTouchEvent"; never executed: return "QTouchEvent"; | 0 | ||||||||||||
3722 | case QEvent::Shortcut: never executed: case QEvent::Shortcut: | 0 | ||||||||||||
3723 | return "QShortcutEvent"; never executed: return "QShortcutEvent"; | 0 | ||||||||||||
3724 | case QEvent::InputMethod: never executed: case QEvent::InputMethod: | 0 | ||||||||||||
3725 | return "QInputMethodEvent"; never executed: return "QInputMethodEvent"; | 0 | ||||||||||||
3726 | case QEvent::InputMethodQuery: never executed: case QEvent::InputMethodQuery: | 0 | ||||||||||||
3727 | return "QInputMethodQueryEvent"; never executed: return "QInputMethodQueryEvent"; | 0 | ||||||||||||
3728 | case QEvent::OrientationChange: never executed: case QEvent::OrientationChange: | 0 | ||||||||||||
3729 | return "QScreenOrientationChangeEvent"; never executed: return "QScreenOrientationChangeEvent"; | 0 | ||||||||||||
3730 | case QEvent::ScrollPrepare: never executed: case QEvent::ScrollPrepare: | 0 | ||||||||||||
3731 | return "QScrollPrepareEvent"; never executed: return "QScrollPrepareEvent"; | 0 | ||||||||||||
3732 | case QEvent::Scroll: never executed: case QEvent::Scroll: | 0 | ||||||||||||
3733 | return "QScrollEvent"; never executed: return "QScrollEvent"; | 0 | ||||||||||||
3734 | case QEvent::GraphicsSceneMouseMove: never executed: case QEvent::GraphicsSceneMouseMove: | 0 | ||||||||||||
3735 | case QEvent::GraphicsSceneMousePress: never executed: case QEvent::GraphicsSceneMousePress: | 0 | ||||||||||||
3736 | case QEvent::GraphicsSceneMouseRelease: never executed: case QEvent::GraphicsSceneMouseRelease: | 0 | ||||||||||||
3737 | case QEvent::GraphicsSceneMouseDoubleClick: never executed: case QEvent::GraphicsSceneMouseDoubleClick: | 0 | ||||||||||||
3738 | return "QGraphicsSceneMouseEvent"; never executed: return "QGraphicsSceneMouseEvent"; | 0 | ||||||||||||
3739 | case QEvent::GraphicsSceneContextMenu: never executed: case QEvent::GraphicsSceneContextMenu: | 0 | ||||||||||||
3740 | case QEvent::GraphicsSceneHoverEnter: never executed: case QEvent::GraphicsSceneHoverEnter: | 0 | ||||||||||||
3741 | case QEvent::GraphicsSceneHoverMove: never executed: case QEvent::GraphicsSceneHoverMove: | 0 | ||||||||||||
3742 | case QEvent::GraphicsSceneHoverLeave: never executed: case QEvent::GraphicsSceneHoverLeave: | 0 | ||||||||||||
3743 | case QEvent::GraphicsSceneHelp: never executed: case QEvent::GraphicsSceneHelp: | 0 | ||||||||||||
3744 | case QEvent::GraphicsSceneDragEnter: never executed: case QEvent::GraphicsSceneDragEnter: | 0 | ||||||||||||
3745 | case QEvent::GraphicsSceneDragMove: never executed: case QEvent::GraphicsSceneDragMove: | 0 | ||||||||||||
3746 | case QEvent::GraphicsSceneDragLeave: never executed: case QEvent::GraphicsSceneDragLeave: | 0 | ||||||||||||
3747 | case QEvent::GraphicsSceneDrop: never executed: case QEvent::GraphicsSceneDrop: | 0 | ||||||||||||
3748 | case QEvent::GraphicsSceneWheel: never executed: case QEvent::GraphicsSceneWheel: | 0 | ||||||||||||
3749 | return "QGraphicsSceneEvent"; never executed: return "QGraphicsSceneEvent"; | 0 | ||||||||||||
3750 | case QEvent::Timer: never executed: case QEvent::Timer: | 0 | ||||||||||||
3751 | return "QTimerEvent"; never executed: return "QTimerEvent"; | 0 | ||||||||||||
3752 | case QEvent::PlatformSurface: never executed: case QEvent::PlatformSurface: | 0 | ||||||||||||
3753 | return "QPlatformSurfaceEvent"; never executed: return "QPlatformSurfaceEvent"; | 0 | ||||||||||||
3754 | default: never executed: default: | 0 | ||||||||||||
3755 | break; never executed: break; | 0 | ||||||||||||
3756 | } | - | ||||||||||||
3757 | return "QEvent"; never executed: return "QEvent"; | 0 | ||||||||||||
3758 | } | - | ||||||||||||
3759 | - | |||||||||||||
3760 | # ifndef QT_NO_DRAGANDDROP | - | ||||||||||||
3761 | - | |||||||||||||
3762 | static void formatDropEvent(QDebug d, const QDropEvent *e) | - | ||||||||||||
3763 | { | - | ||||||||||||
3764 | const QEvent::Type type = e->type(); | - | ||||||||||||
3765 | d << eventClassName(type) << "(dropAction="; | - | ||||||||||||
3766 | QtDebugUtils::formatQEnum(d, e->dropAction()); | - | ||||||||||||
3767 | d << ", proposedAction="; | - | ||||||||||||
3768 | QtDebugUtils::formatQEnum(d, e->proposedAction()); | - | ||||||||||||
3769 | d << ", possibleActions="; | - | ||||||||||||
3770 | QtDebugUtils::formatQFlags(d, e->possibleActions()); | - | ||||||||||||
3771 | d << ", posF="; | - | ||||||||||||
3772 | QtDebugUtils::formatQPoint(d, e->posF()); | - | ||||||||||||
3773 | if (type == QEvent::DragMove || type == QEvent::DragEnter)
| 0 | ||||||||||||
3774 | d << ", answerRect=" << static_cast<const QDragMoveEvent *>(e)->answerRect(); never executed: d << ", answerRect=" << static_cast<const QDragMoveEvent *>(e)->answerRect(); | 0 | ||||||||||||
3775 | d << ", formats=" << e->mimeData()->formats(); | - | ||||||||||||
3776 | QtDebugUtils::formatNonNullQFlags(d, ", keyboardModifiers=", e->keyboardModifiers()); | - | ||||||||||||
3777 | d << ", "; | - | ||||||||||||
3778 | QtDebugUtils::formatQFlags(d, e->mouseButtons()); | - | ||||||||||||
3779 | } never executed: end of block | 0 | ||||||||||||
3780 | - | |||||||||||||
3781 | # endif // !QT_NO_DRAGANDDROP | - | ||||||||||||
3782 | - | |||||||||||||
3783 | # ifndef QT_NO_TABLETEVENT | - | ||||||||||||
3784 | - | |||||||||||||
3785 | static void formatTabletEvent(QDebug d, const QTabletEvent *e) | - | ||||||||||||
3786 | { | - | ||||||||||||
3787 | const QEvent::Type type = e->type(); | - | ||||||||||||
3788 | - | |||||||||||||
3789 | d << eventClassName(type) << '('; | - | ||||||||||||
3790 | QtDebugUtils::formatQEnum(d, type); | - | ||||||||||||
3791 | d << ", device="; | - | ||||||||||||
3792 | QtDebugUtils::formatQEnum(d, e->device()); | - | ||||||||||||
3793 | d << ", pointerType="; | - | ||||||||||||
3794 | QtDebugUtils::formatQEnum(d, e->pointerType()); | - | ||||||||||||
3795 | d << ", uniqueId=" << e->uniqueId() | - | ||||||||||||
3796 | << ", pos=" << e->posF() | - | ||||||||||||
3797 | << ", z=" << e->z() | - | ||||||||||||
3798 | << ", xTilt=" << e->xTilt() | - | ||||||||||||
3799 | << ", yTilt=" << e->yTilt() | - | ||||||||||||
3800 | << ", "; | - | ||||||||||||
3801 | QtDebugUtils::formatQFlags(d, e->buttons()); | - | ||||||||||||
3802 | if (type == QEvent::TabletPress || type == QEvent::TabletMove)
| 0 | ||||||||||||
3803 | d << ", pressure=" << e->pressure(); never executed: d << ", pressure=" << e->pressure(); | 0 | ||||||||||||
3804 | if (e->device() == QTabletEvent::RotationStylus || e->device() == QTabletEvent::FourDMouse)
| 0 | ||||||||||||
3805 | d << ", rotation=" << e->rotation(); never executed: d << ", rotation=" << e->rotation(); | 0 | ||||||||||||
3806 | if (e->device() == QTabletEvent::Airbrush)
| 0 | ||||||||||||
3807 | d << ", tangentialPressure=" << e->tangentialPressure(); never executed: d << ", tangentialPressure=" << e->tangentialPressure(); | 0 | ||||||||||||
3808 | } never executed: end of block | 0 | ||||||||||||
3809 | - | |||||||||||||
3810 | # endif // !QT_NO_TABLETEVENT | - | ||||||||||||
3811 | - | |||||||||||||
3812 | QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &tp) | - | ||||||||||||
3813 | { | - | ||||||||||||
3814 | QDebugStateSaver saver(dbg); | - | ||||||||||||
3815 | dbg.nospace(); | - | ||||||||||||
3816 | dbg << "TouchPoint(" << tp.id() << " ("; | - | ||||||||||||
3817 | QtDebugUtils::formatQRect(dbg, tp.rect()); | - | ||||||||||||
3818 | dbg << ") "; | - | ||||||||||||
3819 | QtDebugUtils::formatQEnum(dbg, tp.state()); | - | ||||||||||||
3820 | dbg << " press " << tp.pressure() << " vel " << tp.velocity() | - | ||||||||||||
3821 | << " start ("; | - | ||||||||||||
3822 | QtDebugUtils::formatQPoint(dbg, tp.startPos()); | - | ||||||||||||
3823 | dbg << ") last ("; | - | ||||||||||||
3824 | QtDebugUtils::formatQPoint(dbg, tp.lastPos()); | - | ||||||||||||
3825 | dbg << ") delta ("; | - | ||||||||||||
3826 | QtDebugUtils::formatQPoint(dbg, tp.pos() - tp.lastPos()); | - | ||||||||||||
3827 | dbg << ')'; | - | ||||||||||||
3828 | return dbg; never executed: return dbg; | 0 | ||||||||||||
3829 | } | - | ||||||||||||
3830 | - | |||||||||||||
3831 | QDebug operator<<(QDebug dbg, const QEvent *e) | - | ||||||||||||
3832 | { | - | ||||||||||||
3833 | QDebugStateSaver saver(dbg); | - | ||||||||||||
3834 | dbg.nospace(); | - | ||||||||||||
3835 | if (!e) {
| 0 | ||||||||||||
3836 | dbg << "QEvent(this = 0x0)"; | - | ||||||||||||
3837 | return dbg; never executed: return dbg; | 0 | ||||||||||||
3838 | } | - | ||||||||||||
3839 | // More useful event output could be added here | - | ||||||||||||
3840 | const QEvent::Type type = e->type(); | - | ||||||||||||
3841 | switch (type) { | - | ||||||||||||
3842 | case QEvent::Expose: never executed: case QEvent::Expose: | 0 | ||||||||||||
3843 | dbg << "QExposeEvent(" << static_cast<const QExposeEvent *>(e)->region() << ')'; | - | ||||||||||||
3844 | break; never executed: break; | 0 | ||||||||||||
3845 | case QEvent::Paint: never executed: case QEvent::Paint: | 0 | ||||||||||||
3846 | dbg << "QPaintEvent(" << static_cast<const QPaintEvent *>(e)->region() << ')'; | - | ||||||||||||
3847 | break; never executed: break; | 0 | ||||||||||||
3848 | case QEvent::MouseButtonPress: never executed: case QEvent::MouseButtonPress: | 0 | ||||||||||||
3849 | case QEvent::MouseMove: never executed: case QEvent::MouseMove: | 0 | ||||||||||||
3850 | case QEvent::MouseButtonRelease: never executed: case QEvent::MouseButtonRelease: | 0 | ||||||||||||
3851 | case QEvent::MouseButtonDblClick: never executed: case QEvent::MouseButtonDblClick: | 0 | ||||||||||||
3852 | case QEvent::NonClientAreaMouseButtonPress: never executed: case QEvent::NonClientAreaMouseButtonPress: | 0 | ||||||||||||
3853 | case QEvent::NonClientAreaMouseMove: never executed: case QEvent::NonClientAreaMouseMove: | 0 | ||||||||||||
3854 | case QEvent::NonClientAreaMouseButtonRelease: never executed: case QEvent::NonClientAreaMouseButtonRelease: | 0 | ||||||||||||
3855 | case QEvent::NonClientAreaMouseButtonDblClick: never executed: case QEvent::NonClientAreaMouseButtonDblClick: | 0 | ||||||||||||
3856 | { | - | ||||||||||||
3857 | const QMouseEvent *me = static_cast<const QMouseEvent*>(e); | - | ||||||||||||
3858 | const Qt::MouseButton button = me->button(); | - | ||||||||||||
3859 | const Qt::MouseButtons buttons = me->buttons(); | - | ||||||||||||
3860 | dbg << "QMouseEvent("; | - | ||||||||||||
3861 | QtDebugUtils::formatQEnum(dbg, type); | - | ||||||||||||
3862 | if (type != QEvent::MouseMove && type != QEvent::NonClientAreaMouseMove) {
| 0 | ||||||||||||
3863 | dbg << ", "; | - | ||||||||||||
3864 | QtDebugUtils::formatQEnum(dbg, button); | - | ||||||||||||
3865 | } never executed: end of block | 0 | ||||||||||||
3866 | if (buttons && button != buttons) {
| 0 | ||||||||||||
3867 | dbg << ", buttons="; | - | ||||||||||||
3868 | QtDebugUtils::formatQFlags(dbg, buttons); | - | ||||||||||||
3869 | } never executed: end of block | 0 | ||||||||||||
3870 | QtDebugUtils::formatNonNullQFlags(dbg, ", ", me->modifiers()); | - | ||||||||||||
3871 | dbg << ", localPos="; | - | ||||||||||||
3872 | QtDebugUtils::formatQPoint(dbg, me->localPos()); | - | ||||||||||||
3873 | dbg << ", screenPos="; | - | ||||||||||||
3874 | QtDebugUtils::formatQPoint(dbg, me->screenPos()); | - | ||||||||||||
3875 | QtDebugUtils::formatNonNullQEnum(dbg, ", ", me->source()); | - | ||||||||||||
3876 | QtDebugUtils::formatNonNullQFlags(dbg, ", flags=", me->flags()); | - | ||||||||||||
3877 | dbg << ')'; | - | ||||||||||||
3878 | } | - | ||||||||||||
3879 | break; never executed: break; | 0 | ||||||||||||
3880 | # ifndef QT_NO_WHEELEVENT | - | ||||||||||||
3881 | case QEvent::Wheel: { never executed: case QEvent::Wheel: | 0 | ||||||||||||
3882 | const QWheelEvent *we = static_cast<const QWheelEvent *>(e); | - | ||||||||||||
3883 | dbg << "QWheelEvent(" << "pixelDelta=" << we->pixelDelta() << ", angleDelta=" << we->angleDelta() << ')'; | - | ||||||||||||
3884 | } | - | ||||||||||||
3885 | break; never executed: break; | 0 | ||||||||||||
3886 | # endif // !QT_NO_WHEELEVENT | - | ||||||||||||
3887 | case QEvent::KeyPress: never executed: case QEvent::KeyPress: | 0 | ||||||||||||
3888 | case QEvent::KeyRelease: never executed: case QEvent::KeyRelease: | 0 | ||||||||||||
3889 | case QEvent::ShortcutOverride: never executed: case QEvent::ShortcutOverride: | 0 | ||||||||||||
3890 | { | - | ||||||||||||
3891 | const QKeyEvent *ke = static_cast<const QKeyEvent *>(e); | - | ||||||||||||
3892 | dbg << "QKeyEvent("; | - | ||||||||||||
3893 | QtDebugUtils::formatQEnum(dbg, type); | - | ||||||||||||
3894 | dbg << ", "; | - | ||||||||||||
3895 | QtDebugUtils::formatQEnum(dbg, static_cast<Qt::Key>(ke->key())); | - | ||||||||||||
3896 | QtDebugUtils::formatNonNullQFlags(dbg, ", ", ke->modifiers()); | - | ||||||||||||
3897 | if (!ke->text().isEmpty())
| 0 | ||||||||||||
3898 | dbg << ", text=" << ke->text(); never executed: dbg << ", text=" << ke->text(); | 0 | ||||||||||||
3899 | if (ke->isAutoRepeat())
| 0 | ||||||||||||
3900 | dbg << ", autorepeat, count=" << ke->count(); never executed: dbg << ", autorepeat, count=" << ke->count(); | 0 | ||||||||||||
3901 | dbg << ')'; | - | ||||||||||||
3902 | } | - | ||||||||||||
3903 | break; never executed: break; | 0 | ||||||||||||
3904 | case QEvent::Shortcut: { never executed: case QEvent::Shortcut: | 0 | ||||||||||||
3905 | const QShortcutEvent *se = static_cast<const QShortcutEvent *>(e); | - | ||||||||||||
3906 | dbg << "QShortcutEvent(" << se->key().toString() << ", id=" << se->shortcutId(); | - | ||||||||||||
3907 | if (se->isAmbiguous())
| 0 | ||||||||||||
3908 | dbg << ", ambiguous"; never executed: dbg << ", ambiguous"; | 0 | ||||||||||||
3909 | dbg << ')'; | - | ||||||||||||
3910 | } | - | ||||||||||||
3911 | break; never executed: break; | 0 | ||||||||||||
3912 | case QEvent::FocusAboutToChange: never executed: case QEvent::FocusAboutToChange: | 0 | ||||||||||||
3913 | case QEvent::FocusIn: never executed: case QEvent::FocusIn: | 0 | ||||||||||||
3914 | case QEvent::FocusOut: never executed: case QEvent::FocusOut: | 0 | ||||||||||||
3915 | dbg << "QFocusEvent("; | - | ||||||||||||
3916 | QtDebugUtils::formatQEnum(dbg, type); | - | ||||||||||||
3917 | dbg << ", "; | - | ||||||||||||
3918 | QtDebugUtils::formatQEnum(dbg, static_cast<const QFocusEvent *>(e)->reason()); | - | ||||||||||||
3919 | dbg << ')'; | - | ||||||||||||
3920 | break; never executed: break; | 0 | ||||||||||||
3921 | case QEvent::Move: { never executed: case QEvent::Move: | 0 | ||||||||||||
3922 | const QMoveEvent *me = static_cast<const QMoveEvent *>(e); | - | ||||||||||||
3923 | dbg << "QMoveEvent("; | - | ||||||||||||
3924 | QtDebugUtils::formatQPoint(dbg, me->pos()); | - | ||||||||||||
3925 | if (!me->spontaneous())
| 0 | ||||||||||||
3926 | dbg << ", non-spontaneous"; never executed: dbg << ", non-spontaneous"; | 0 | ||||||||||||
3927 | dbg << ')'; | - | ||||||||||||
3928 | } | - | ||||||||||||
3929 | break; never executed: break; | 0 | ||||||||||||
3930 | case QEvent::Resize: { never executed: case QEvent::Resize: | 0 | ||||||||||||
3931 | const QResizeEvent *re = static_cast<const QResizeEvent *>(e); | - | ||||||||||||
3932 | dbg << "QResizeEvent("; | - | ||||||||||||
3933 | QtDebugUtils::formatQSize(dbg, re->size()); | - | ||||||||||||
3934 | if (!re->spontaneous())
| 0 | ||||||||||||
3935 | dbg << ", non-spontaneous"; never executed: dbg << ", non-spontaneous"; | 0 | ||||||||||||
3936 | dbg << ')'; | - | ||||||||||||
3937 | } | - | ||||||||||||
3938 | break; never executed: break; | 0 | ||||||||||||
3939 | # ifndef QT_NO_DRAGANDDROP | - | ||||||||||||
3940 | case QEvent::DragEnter: never executed: case QEvent::DragEnter: | 0 | ||||||||||||
3941 | case QEvent::DragMove: never executed: case QEvent::DragMove: | 0 | ||||||||||||
3942 | case QEvent::Drop: never executed: case QEvent::Drop: | 0 | ||||||||||||
3943 | formatDropEvent(dbg, static_cast<const QDropEvent *>(e)); | - | ||||||||||||
3944 | break; never executed: break; | 0 | ||||||||||||
3945 | # endif // !QT_NO_DRAGANDDROP | - | ||||||||||||
3946 | case QEvent::InputMethod: never executed: case QEvent::InputMethod: | 0 | ||||||||||||
3947 | formatInputMethodEvent(dbg, static_cast<const QInputMethodEvent *>(e)); | - | ||||||||||||
3948 | break; never executed: break; | 0 | ||||||||||||
3949 | case QEvent::InputMethodQuery: never executed: case QEvent::InputMethodQuery: | 0 | ||||||||||||
3950 | formatInputMethodQueryEvent(dbg, static_cast<const QInputMethodQueryEvent *>(e)); | - | ||||||||||||
3951 | break; never executed: break; | 0 | ||||||||||||
3952 | case QEvent::TouchBegin: never executed: case QEvent::TouchBegin: | 0 | ||||||||||||
3953 | case QEvent::TouchUpdate: never executed: case QEvent::TouchUpdate: | 0 | ||||||||||||
3954 | case QEvent::TouchEnd: never executed: case QEvent::TouchEnd: | 0 | ||||||||||||
3955 | formatTouchEvent(dbg, *static_cast<const QTouchEvent*>(e)); | - | ||||||||||||
3956 | break; never executed: break; | 0 | ||||||||||||
3957 | case QEvent::ChildAdded: never executed: case QEvent::ChildAdded: | 0 | ||||||||||||
3958 | case QEvent::ChildPolished: never executed: case QEvent::ChildPolished: | 0 | ||||||||||||
3959 | case QEvent::ChildRemoved: never executed: case QEvent::ChildRemoved: | 0 | ||||||||||||
3960 | dbg << "QChildEvent("; | - | ||||||||||||
3961 | QtDebugUtils::formatQEnum(dbg, type); | - | ||||||||||||
3962 | dbg << ", " << (static_cast<const QChildEvent*>(e))->child() << ')'; | - | ||||||||||||
3963 | break; never executed: break; | 0 | ||||||||||||
3964 | # ifndef QT_NO_GESTURES | - | ||||||||||||
3965 | case QEvent::NativeGesture: { never executed: case QEvent::NativeGesture: | 0 | ||||||||||||
3966 | const QNativeGestureEvent *ne = static_cast<const QNativeGestureEvent *>(e); | - | ||||||||||||
3967 | dbg << "QNativeGestureEvent("; | - | ||||||||||||
3968 | QtDebugUtils::formatQEnum(dbg, ne->gestureType()); | - | ||||||||||||
3969 | dbg << "localPos="; | - | ||||||||||||
3970 | QtDebugUtils::formatQPoint(dbg, ne->localPos()); | - | ||||||||||||
3971 | dbg << ", value=" << ne->value() << ')'; | - | ||||||||||||
3972 | } | - | ||||||||||||
3973 | break; never executed: break; | 0 | ||||||||||||
3974 | # endif // !QT_NO_GESTURES | - | ||||||||||||
3975 | case QEvent::ApplicationStateChange: never executed: case QEvent::ApplicationStateChange: | 0 | ||||||||||||
3976 | dbg << "QApplicationStateChangeEvent("; | - | ||||||||||||
3977 | QtDebugUtils::formatQEnum(dbg, static_cast<const QApplicationStateChangeEvent *>(e)->applicationState()); | - | ||||||||||||
3978 | dbg << ')'; | - | ||||||||||||
3979 | break; never executed: break; | 0 | ||||||||||||
3980 | case QEvent::ContextMenu: never executed: case QEvent::ContextMenu: | 0 | ||||||||||||
3981 | dbg << "QContextMenuEvent(" << static_cast<const QContextMenuEvent *>(e)->pos() << ')'; | - | ||||||||||||
3982 | break; never executed: break; | 0 | ||||||||||||
3983 | # ifndef QT_NO_TABLETEVENT | - | ||||||||||||
3984 | case QEvent::TabletEnterProximity: never executed: case QEvent::TabletEnterProximity: | 0 | ||||||||||||
3985 | case QEvent::TabletLeaveProximity: never executed: case QEvent::TabletLeaveProximity: | 0 | ||||||||||||
3986 | case QEvent::TabletPress: never executed: case QEvent::TabletPress: | 0 | ||||||||||||
3987 | case QEvent::TabletMove: never executed: case QEvent::TabletMove: | 0 | ||||||||||||
3988 | case QEvent::TabletRelease: never executed: case QEvent::TabletRelease: | 0 | ||||||||||||
3989 | formatTabletEvent(dbg, static_cast<const QTabletEvent *>(e)); | - | ||||||||||||
3990 | break; never executed: break; | 0 | ||||||||||||
3991 | # endif // !QT_NO_TABLETEVENT | - | ||||||||||||
3992 | case QEvent::Enter: never executed: case QEvent::Enter: | 0 | ||||||||||||
3993 | dbg << "QEnterEvent(" << static_cast<const QEnterEvent *>(e)->pos() << ')'; | - | ||||||||||||
3994 | break; never executed: break; | 0 | ||||||||||||
3995 | case QEvent::Timer: never executed: case QEvent::Timer: | 0 | ||||||||||||
3996 | dbg << "QTimerEvent(id=" << static_cast<const QTimerEvent *>(e)->timerId() << ')'; | - | ||||||||||||
3997 | break; never executed: break; | 0 | ||||||||||||
3998 | case QEvent::PlatformSurface: never executed: case QEvent::PlatformSurface: | 0 | ||||||||||||
3999 | dbg << "QPlatformSurfaceEvent(surfaceEventType="; | - | ||||||||||||
4000 | switch (static_cast<const QPlatformSurfaceEvent *>(e)->surfaceEventType()) { | - | ||||||||||||
4001 | case QPlatformSurfaceEvent::SurfaceCreated: never executed: case QPlatformSurfaceEvent::SurfaceCreated: | 0 | ||||||||||||
4002 | dbg << "SurfaceCreated"; | - | ||||||||||||
4003 | break; never executed: break; | 0 | ||||||||||||
4004 | case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: never executed: case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: | 0 | ||||||||||||
4005 | dbg << "SurfaceAboutToBeDestroyed"; | - | ||||||||||||
4006 | break; never executed: break; | 0 | ||||||||||||
4007 | } | - | ||||||||||||
4008 | dbg << ')'; | - | ||||||||||||
4009 | break; never executed: break; | 0 | ||||||||||||
4010 | default: never executed: default: | 0 | ||||||||||||
4011 | dbg << eventClassName(type) << '('; | - | ||||||||||||
4012 | QtDebugUtils::formatQEnum(dbg, type); | - | ||||||||||||
4013 | dbg << ", " << (const void *)e << ')'; | - | ||||||||||||
4014 | break; never executed: break; | 0 | ||||||||||||
4015 | } | - | ||||||||||||
4016 | return dbg; never executed: return dbg; | 0 | ||||||||||||
4017 | } | - | ||||||||||||
4018 | #endif // !QT_NO_DEBUG_STREAM | - | ||||||||||||
4019 | - | |||||||||||||
4020 | /*! | - | ||||||||||||
4021 | \class QShortcutEvent | - | ||||||||||||
4022 | \brief The QShortcutEvent class provides an event which is generated when | - | ||||||||||||
4023 | the user presses a key combination. | - | ||||||||||||
4024 | - | |||||||||||||
4025 | \ingroup events | - | ||||||||||||
4026 | \inmodule QtGui | - | ||||||||||||
4027 | - | |||||||||||||
4028 | Normally you do not need to use this class directly; QShortcut | - | ||||||||||||
4029 | provides a higher-level interface to handle shortcut keys. | - | ||||||||||||
4030 | - | |||||||||||||
4031 | \sa QShortcut | - | ||||||||||||
4032 | */ | - | ||||||||||||
4033 | - | |||||||||||||
4034 | /*! | - | ||||||||||||
4035 | \fn const QKeySequence &QShortcutEvent::key() const | - | ||||||||||||
4036 | - | |||||||||||||
4037 | Returns the key sequence that triggered the event. | - | ||||||||||||
4038 | */ | - | ||||||||||||
4039 | - | |||||||||||||
4040 | /*! | - | ||||||||||||
4041 | \fn int QShortcutEvent::shortcutId() const | - | ||||||||||||
4042 | - | |||||||||||||
4043 | Returns the ID of the QShortcut object for which this event was | - | ||||||||||||
4044 | generated. | - | ||||||||||||
4045 | - | |||||||||||||
4046 | \sa QShortcut::id() | - | ||||||||||||
4047 | */ | - | ||||||||||||
4048 | - | |||||||||||||
4049 | /*! | - | ||||||||||||
4050 | \fn bool QShortcutEvent::isAmbiguous() const | - | ||||||||||||
4051 | - | |||||||||||||
4052 | Returns \c true if the key sequence that triggered the event is | - | ||||||||||||
4053 | ambiguous. | - | ||||||||||||
4054 | - | |||||||||||||
4055 | \sa QShortcut::activatedAmbiguously() | - | ||||||||||||
4056 | */ | - | ||||||||||||
4057 | - | |||||||||||||
4058 | /*! | - | ||||||||||||
4059 | \class QWindowStateChangeEvent | - | ||||||||||||
4060 | \ingroup events | - | ||||||||||||
4061 | \inmodule QtGui | - | ||||||||||||
4062 | - | |||||||||||||
4063 | \brief The QWindowStateChangeEvent class provides the window state before a | - | ||||||||||||
4064 | window state change. | - | ||||||||||||
4065 | */ | - | ||||||||||||
4066 | - | |||||||||||||
4067 | /*! \fn Qt::WindowStates QWindowStateChangeEvent::oldState() const | - | ||||||||||||
4068 | - | |||||||||||||
4069 | Returns the state of the window before the change. | - | ||||||||||||
4070 | */ | - | ||||||||||||
4071 | - | |||||||||||||
4072 | /*! \internal | - | ||||||||||||
4073 | */ | - | ||||||||||||
4074 | QWindowStateChangeEvent::QWindowStateChangeEvent(Qt::WindowStates s, bool isOverride) | - | ||||||||||||
4075 | : QEvent(WindowStateChange), ostate(s), m_override(isOverride) | - | ||||||||||||
4076 | { | - | ||||||||||||
4077 | } never executed: end of block | 0 | ||||||||||||
4078 | - | |||||||||||||
4079 | /*! \internal | - | ||||||||||||
4080 | */ | - | ||||||||||||
4081 | bool QWindowStateChangeEvent::isOverride() const | - | ||||||||||||
4082 | { | - | ||||||||||||
4083 | return m_override; never executed: return m_override; | 0 | ||||||||||||
4084 | } | - | ||||||||||||
4085 | - | |||||||||||||
4086 | /*! \internal | - | ||||||||||||
4087 | */ | - | ||||||||||||
4088 | QWindowStateChangeEvent::~QWindowStateChangeEvent() | - | ||||||||||||
4089 | { | - | ||||||||||||
4090 | } | - | ||||||||||||
4091 | - | |||||||||||||
4092 | - | |||||||||||||
4093 | /*! | - | ||||||||||||
4094 | \class QTouchEvent | - | ||||||||||||
4095 | \brief The QTouchEvent class contains parameters that describe a touch event. | - | ||||||||||||
4096 | \since 4.6 | - | ||||||||||||
4097 | \ingroup events | - | ||||||||||||
4098 | \ingroup touch | - | ||||||||||||
4099 | \inmodule QtGui | - | ||||||||||||
4100 | - | |||||||||||||
4101 | \section1 Enabling Touch Events | - | ||||||||||||
4102 | - | |||||||||||||
4103 | Touch events occur when pressing, releasing, or moving one or more touch points on a touch | - | ||||||||||||
4104 | device (such as a touch-screen or track-pad). To receive touch events, widgets have to have the | - | ||||||||||||
4105 | Qt::WA_AcceptTouchEvents attribute set and graphics items need to have the | - | ||||||||||||
4106 | \l{QGraphicsItem::setAcceptTouchEvents()}{acceptTouchEvents} attribute set to true. | - | ||||||||||||
4107 | - | |||||||||||||
4108 | When using QAbstractScrollArea based widgets, you should enable the Qt::WA_AcceptTouchEvents | - | ||||||||||||
4109 | attribute on the scroll area's \l{QAbstractScrollArea::viewport()}{viewport}. | - | ||||||||||||
4110 | - | |||||||||||||
4111 | Similarly to QMouseEvent, Qt automatically grabs each touch point on the first press inside a | - | ||||||||||||
4112 | widget, and the widget will receive all updates for the touch point until it is released. | - | ||||||||||||
4113 | Note that it is possible for a widget to receive events for numerous touch points, and that | - | ||||||||||||
4114 | multiple widgets may be receiving touch events at the same time. | - | ||||||||||||
4115 | - | |||||||||||||
4116 | \section1 Event Handling | - | ||||||||||||
4117 | - | |||||||||||||
4118 | All touch events are of type QEvent::TouchBegin, QEvent::TouchUpdate, QEvent::TouchEnd or | - | ||||||||||||
4119 | QEvent::TouchCancel. Reimplement QWidget::event() or QAbstractScrollArea::viewportEvent() for | - | ||||||||||||
4120 | widgets and QGraphicsItem::sceneEvent() for items in a graphics view to receive touch events. | - | ||||||||||||
4121 | - | |||||||||||||
4122 | Unlike widgets, QWindows receive touch events always, there is no need to opt in. When working | - | ||||||||||||
4123 | directly with a QWindow, it is enough to reimplement QWindow::touchEvent(). | - | ||||||||||||
4124 | - | |||||||||||||
4125 | The QEvent::TouchUpdate and QEvent::TouchEnd events are sent to the widget or item that | - | ||||||||||||
4126 | accepted the QEvent::TouchBegin event. If the QEvent::TouchBegin event is not accepted and not | - | ||||||||||||
4127 | filtered by an event filter, then no further touch events are sent until the next | - | ||||||||||||
4128 | QEvent::TouchBegin. | - | ||||||||||||
4129 | - | |||||||||||||
4130 | Some systems may send an event of type QEvent::TouchCancel. Upon receiving this event | - | ||||||||||||
4131 | applications are requested to ignore the entire active touch sequence. For example in a | - | ||||||||||||
4132 | composited system the compositor may decide to treat certain gestures as system-wide | - | ||||||||||||
4133 | gestures. Whenever such a decision is made (the gesture is recognized), the clients will be | - | ||||||||||||
4134 | notified with a QEvent::TouchCancel event so they can update their state accordingly. | - | ||||||||||||
4135 | - | |||||||||||||
4136 | The touchPoints() function returns a list of all touch points contained in the event. Note that | - | ||||||||||||
4137 | this list may be empty, for example in case of a QEvent::TouchCancel event. Information about | - | ||||||||||||
4138 | each touch point can be retrieved using the QTouchEvent::TouchPoint class. The | - | ||||||||||||
4139 | Qt::TouchPointState enum describes the different states that a touch point may have. | - | ||||||||||||
4140 | - | |||||||||||||
4141 | \note The list of touchPoints() will never be partial: A touch event will always contain a touch | - | ||||||||||||
4142 | point for each existing physical touch contacts targetting the window or widget to which the | - | ||||||||||||
4143 | event is sent. For instance, assuming that all touches target the same window or widget, an | - | ||||||||||||
4144 | event with a condition of touchPoints().count()==2 is guaranteed to imply that the number of | - | ||||||||||||
4145 | fingers touching the touchscreen or touchpad is exactly two. | - | ||||||||||||
4146 | - | |||||||||||||
4147 | \section1 Event Delivery and Propagation | - | ||||||||||||
4148 | - | |||||||||||||
4149 | By default, QGuiApplication translates the first touch point in a QTouchEvent into | - | ||||||||||||
4150 | a QMouseEvent. This makes it possible to enable touch events on existing widgets that do not | - | ||||||||||||
4151 | normally handle QTouchEvent. See below for information on some special considerations needed | - | ||||||||||||
4152 | when doing this. | - | ||||||||||||
4153 | - | |||||||||||||
4154 | QEvent::TouchBegin is the first touch event sent to a widget. The QEvent::TouchBegin event | - | ||||||||||||
4155 | contains a special accept flag that indicates whether the receiver wants the event. By default, | - | ||||||||||||
4156 | the event is accepted. You should call ignore() if the touch event is not handled by your | - | ||||||||||||
4157 | widget. The QEvent::TouchBegin event is propagated up the parent widget chain until a widget | - | ||||||||||||
4158 | accepts it with accept(), or an event filter consumes it. For QGraphicsItems, the | - | ||||||||||||
4159 | QEvent::TouchBegin event is propagated to items under the mouse (similar to mouse event | - | ||||||||||||
4160 | propagation for QGraphicsItems). | - | ||||||||||||
4161 | - | |||||||||||||
4162 | \section1 Touch Point Grouping | - | ||||||||||||
4163 | - | |||||||||||||
4164 | As mentioned above, it is possible that several widgets can be receiving QTouchEvents at the | - | ||||||||||||
4165 | same time. However, Qt makes sure to never send duplicate QEvent::TouchBegin events to the same | - | ||||||||||||
4166 | widget, which could theoretically happen during propagation if, for example, the user touched 2 | - | ||||||||||||
4167 | separate widgets in a QGroupBox and both widgets ignored the QEvent::TouchBegin event. | - | ||||||||||||
4168 | - | |||||||||||||
4169 | To avoid this, Qt will group new touch points together using the following rules: | - | ||||||||||||
4170 | - | |||||||||||||
4171 | \list | - | ||||||||||||
4172 | - | |||||||||||||
4173 | \li When the first touch point is detected, the destination widget is determined firstly by the | - | ||||||||||||
4174 | location on screen and secondly by the propagation rules. | - | ||||||||||||
4175 | - | |||||||||||||
4176 | \li When additional touch points are detected, Qt first looks to see if there are any active | - | ||||||||||||
4177 | touch points on any ancestor or descendent of the widget under the new touch point. If there | - | ||||||||||||
4178 | are, the new touch point is grouped with the first, and the new touch point will be sent in a | - | ||||||||||||
4179 | single QTouchEvent to the widget that handled the first touch point. (The widget under the new | - | ||||||||||||
4180 | touch point will not receive an event). | - | ||||||||||||
4181 | - | |||||||||||||
4182 | \endlist | - | ||||||||||||
4183 | - | |||||||||||||
4184 | This makes it possible for sibling widgets to handle touch events independently while making | - | ||||||||||||
4185 | sure that the sequence of QTouchEvents is always correct. | - | ||||||||||||
4186 | - | |||||||||||||
4187 | \section1 Mouse Events and Touch Event Synthesizing | - | ||||||||||||
4188 | - | |||||||||||||
4189 | QTouchEvent delivery is independent from that of QMouseEvent. The application flags | - | ||||||||||||
4190 | Qt::AA_SynthesizeTouchForUnhandledMouseEvents and Qt::AA_SynthesizeMouseForUnhandledTouchEvents | - | ||||||||||||
4191 | can be used to enable or disable automatic synthesizing of touch events to mouse events and | - | ||||||||||||
4192 | mouse events to touch events. | - | ||||||||||||
4193 | - | |||||||||||||
4194 | \section1 Caveats | - | ||||||||||||
4195 | - | |||||||||||||
4196 | \list | - | ||||||||||||
4197 | - | |||||||||||||
4198 | \li As mentioned above, enabling touch events means multiple widgets can be receiving touch | - | ||||||||||||
4199 | events simultaneously. Combined with the default QWidget::event() handling for QTouchEvents, | - | ||||||||||||
4200 | this gives you great flexibility in designing touch user interfaces. Be aware of the | - | ||||||||||||
4201 | implications. For example, it is possible that the user is moving a QSlider with one finger and | - | ||||||||||||
4202 | pressing a QPushButton with another. The signals emitted by these widgets will be | - | ||||||||||||
4203 | interleaved. | - | ||||||||||||
4204 | - | |||||||||||||
4205 | \li Recursion into the event loop using one of the exec() methods (e.g., QDialog::exec() or | - | ||||||||||||
4206 | QMenu::exec()) in a QTouchEvent event handler is not supported. Since there are multiple event | - | ||||||||||||
4207 | recipients, recursion may cause problems, including but not limited to lost events | - | ||||||||||||
4208 | and unexpected infinite recursion. | - | ||||||||||||
4209 | - | |||||||||||||
4210 | \li QTouchEvents are not affected by a \l{QWidget::grabMouse()}{mouse grab} or an | - | ||||||||||||
4211 | \l{QApplication::activePopupWidget()}{active pop-up widget}. The behavior of QTouchEvents is | - | ||||||||||||
4212 | undefined when opening a pop-up or grabbing the mouse while there are more than one active touch | - | ||||||||||||
4213 | points. | - | ||||||||||||
4214 | - | |||||||||||||
4215 | \endlist | - | ||||||||||||
4216 | - | |||||||||||||
4217 | \sa QTouchEvent::TouchPoint, Qt::TouchPointState, Qt::WA_AcceptTouchEvents, | - | ||||||||||||
4218 | QGraphicsItem::acceptTouchEvents() | - | ||||||||||||
4219 | */ | - | ||||||||||||
4220 | - | |||||||||||||
4221 | /*! \enum QTouchEvent::DeviceType | - | ||||||||||||
4222 | \obsolete | - | ||||||||||||
4223 | - | |||||||||||||
4224 | This enum represents the type of device that generated a QTouchEvent. | - | ||||||||||||
4225 | - | |||||||||||||
4226 | This enum has been deprecated. Use QTouchDevice::DeviceType instead. | - | ||||||||||||
4227 | \omitvalue TouchPad | - | ||||||||||||
4228 | \omitvalue TouchScreen | - | ||||||||||||
4229 | - | |||||||||||||
4230 | \sa QTouchDevice::DeviceType, QTouchDevice::type(), QTouchEvent::device() | - | ||||||||||||
4231 | */ | - | ||||||||||||
4232 | - | |||||||||||||
4233 | /*! | - | ||||||||||||
4234 | Constructs a QTouchEvent with the given \a eventType, \a device, and | - | ||||||||||||
4235 | \a touchPoints. The \a touchPointStates and \a modifiers | - | ||||||||||||
4236 | are the current touch point states and keyboard modifiers at the time of | - | ||||||||||||
4237 | the event. | - | ||||||||||||
4238 | */ | - | ||||||||||||
4239 | QTouchEvent::QTouchEvent(QEvent::Type eventType, | - | ||||||||||||
4240 | QTouchDevice *device, | - | ||||||||||||
4241 | Qt::KeyboardModifiers modifiers, | - | ||||||||||||
4242 | Qt::TouchPointStates touchPointStates, | - | ||||||||||||
4243 | const QList<QTouchEvent::TouchPoint> &touchPoints) | - | ||||||||||||
4244 | : QInputEvent(eventType, modifiers), | - | ||||||||||||
4245 | _window(0), | - | ||||||||||||
4246 | _target(0), | - | ||||||||||||
4247 | _device(device), | - | ||||||||||||
4248 | _touchPointStates(touchPointStates), | - | ||||||||||||
4249 | _touchPoints(touchPoints) | - | ||||||||||||
4250 | { never executed: }end of block never executed: end of block | 0 | ||||||||||||
4251 | - | |||||||||||||
4252 | /*! | - | ||||||||||||
4253 | Destroys the QTouchEvent. | - | ||||||||||||
4254 | */ | - | ||||||||||||
4255 | QTouchEvent::~QTouchEvent() | - | ||||||||||||
4256 | { } | - | ||||||||||||
4257 | - | |||||||||||||
4258 | /*! \fn QWindow *QTouchEvent::window() const | - | ||||||||||||
4259 | - | |||||||||||||
4260 | Returns the window on which the event occurred. Useful for doing | - | ||||||||||||
4261 | global-local mapping on data like rawScreenPositions() which, | - | ||||||||||||
4262 | for performance reasons, only stores the global positions in the | - | ||||||||||||
4263 | touch event. | - | ||||||||||||
4264 | */ | - | ||||||||||||
4265 | - | |||||||||||||
4266 | /*! \fn QObject *QTouchEvent::target() const | - | ||||||||||||
4267 | - | |||||||||||||
4268 | Returns the target object within the window on which the event occurred. | - | ||||||||||||
4269 | This is typically a QWidget or a QQuickItem. May be 0 when no specific target is available. | - | ||||||||||||
4270 | */ | - | ||||||||||||
4271 | - | |||||||||||||
4272 | /*! \fn QTouchEvent::DeviceType QTouchEvent::deviceType() const | - | ||||||||||||
4273 | \obsolete | - | ||||||||||||
4274 | - | |||||||||||||
4275 | Returns the touch device Type, which is of type \l {QTouchEvent::DeviceType} {DeviceType}. | - | ||||||||||||
4276 | - | |||||||||||||
4277 | This function has been deprecated. Use QTouchDevice::type() instead. | - | ||||||||||||
4278 | - | |||||||||||||
4279 | \sa QTouchDevice::type(), QTouchEvent::device() | - | ||||||||||||
4280 | */ | - | ||||||||||||
4281 | - | |||||||||||||
4282 | /*! \fn QTouchEvent::TouchPoint::TouchPoint(TouchPoint &&other) | - | ||||||||||||
4283 | - | |||||||||||||
4284 | Move-constructs a TouchPoint instance, making it point to the same | - | ||||||||||||
4285 | object that \a other was pointing to. | - | ||||||||||||
4286 | */ | - | ||||||||||||
4287 | - | |||||||||||||
4288 | /*! \fn Qt::TouchPointStates QTouchEvent::touchPointStates() const | - | ||||||||||||
4289 | - | |||||||||||||
4290 | Returns a bitwise OR of all the touch point states for this event. | - | ||||||||||||
4291 | */ | - | ||||||||||||
4292 | - | |||||||||||||
4293 | /*! \fn const QList<QTouchEvent::TouchPoint> &QTouchEvent::touchPoints() const | - | ||||||||||||
4294 | - | |||||||||||||
4295 | Returns the list of touch points contained in the touch event. | - | ||||||||||||
4296 | */ | - | ||||||||||||
4297 | - | |||||||||||||
4298 | /*! \fn QTouchDevice* QTouchEvent::device() const | - | ||||||||||||
4299 | - | |||||||||||||
4300 | Returns the touch device from which this touch event originates. | - | ||||||||||||
4301 | */ | - | ||||||||||||
4302 | - | |||||||||||||
4303 | /*! \fn void QTouchEvent::setWindow(QWindow *window) | - | ||||||||||||
4304 | - | |||||||||||||
4305 | \internal | - | ||||||||||||
4306 | - | |||||||||||||
4307 | Sets the window for this event. | - | ||||||||||||
4308 | */ | - | ||||||||||||
4309 | - | |||||||||||||
4310 | /*! \fn void QTouchEvent::setTarget(QObject *target) | - | ||||||||||||
4311 | - | |||||||||||||
4312 | \internal | - | ||||||||||||
4313 | - | |||||||||||||
4314 | Sets the target within the window (typically a widget) for this event. | - | ||||||||||||
4315 | */ | - | ||||||||||||
4316 | - | |||||||||||||
4317 | /*! \fn void QTouchEvent::setTouchPointStates(Qt::TouchPointStates touchPointStates) | - | ||||||||||||
4318 | - | |||||||||||||
4319 | \internal | - | ||||||||||||
4320 | - | |||||||||||||
4321 | Sets a bitwise OR of all the touch point states for this event. | - | ||||||||||||
4322 | */ | - | ||||||||||||
4323 | - | |||||||||||||
4324 | /*! \fn void QTouchEvent::setTouchPoints(const QList<QTouchEvent::TouchPoint> &touchPoints) | - | ||||||||||||
4325 | - | |||||||||||||
4326 | \internal | - | ||||||||||||
4327 | - | |||||||||||||
4328 | Sets the list of touch points for this event. | - | ||||||||||||
4329 | */ | - | ||||||||||||
4330 | - | |||||||||||||
4331 | /*! \fn void QTouchEvent::setDevice(QTouchDevice *adevice) | - | ||||||||||||
4332 | - | |||||||||||||
4333 | \internal | - | ||||||||||||
4334 | - | |||||||||||||
4335 | Sets the device to \a adevice. | - | ||||||||||||
4336 | */ | - | ||||||||||||
4337 | - | |||||||||||||
4338 | /*! \class QTouchEvent::TouchPoint | - | ||||||||||||
4339 | \brief The TouchPoint class provides information about a touch point in a QTouchEvent. | - | ||||||||||||
4340 | \since 4.6 | - | ||||||||||||
4341 | \inmodule QtGui | - | ||||||||||||
4342 | */ | - | ||||||||||||
4343 | - | |||||||||||||
4344 | /*! \enum TouchPoint::InfoFlag | - | ||||||||||||
4345 | - | |||||||||||||
4346 | The values of this enum describe additional information about a touch point. | - | ||||||||||||
4347 | - | |||||||||||||
4348 | \value Pen Indicates that the contact has been made by a designated pointing device (e.g. a pen) instead of a finger. | - | ||||||||||||
4349 | */ | - | ||||||||||||
4350 | - | |||||||||||||
4351 | /*! | - | ||||||||||||
4352 | \internal | - | ||||||||||||
4353 | - | |||||||||||||
4354 | Constructs a QTouchEvent::TouchPoint for use in a QTouchEvent. | - | ||||||||||||
4355 | */ | - | ||||||||||||
4356 | QTouchEvent::TouchPoint::TouchPoint(int id) | - | ||||||||||||
4357 | : d(new QTouchEventTouchPointPrivate(id)) | - | ||||||||||||
4358 | { never executed: }end of block never executed: end of block | 0 | ||||||||||||
4359 | - | |||||||||||||
4360 | /*! | - | ||||||||||||
4361 | \fn TouchPoint::TouchPoint(const TouchPoint &other) | - | ||||||||||||
4362 | \internal | - | ||||||||||||
4363 | - | |||||||||||||
4364 | Constructs a copy of \a other. | - | ||||||||||||
4365 | */ | - | ||||||||||||
4366 | QTouchEvent::TouchPoint::TouchPoint(const QTouchEvent::TouchPoint &other) | - | ||||||||||||
4367 | : d(other.d) | - | ||||||||||||
4368 | { | - | ||||||||||||
4369 | d->ref.ref(); | - | ||||||||||||
4370 | } never executed: end of block | 0 | ||||||||||||
4371 | - | |||||||||||||
4372 | /*! | - | ||||||||||||
4373 | \internal | - | ||||||||||||
4374 | - | |||||||||||||
4375 | Destroys the QTouchEvent::TouchPoint. | - | ||||||||||||
4376 | */ | - | ||||||||||||
4377 | QTouchEvent::TouchPoint::~TouchPoint() | - | ||||||||||||
4378 | { | - | ||||||||||||
4379 | if (d && !d->ref.deref())
| 0 | ||||||||||||
4380 | delete d; never executed: delete d; | 0 | ||||||||||||
4381 | } never executed: end of block | 0 | ||||||||||||
4382 | - | |||||||||||||
4383 | /*! | - | ||||||||||||
4384 | Returns the id number of this touch point. | - | ||||||||||||
4385 | - | |||||||||||||
4386 | Do not assume that id numbers start at zero or that they are sequential. | - | ||||||||||||
4387 | Such an assumption is often false due to the way the underlying drivers work. | - | ||||||||||||
4388 | */ | - | ||||||||||||
4389 | int QTouchEvent::TouchPoint::id() const | - | ||||||||||||
4390 | { | - | ||||||||||||
4391 | return d->id; never executed: return d->id; | 0 | ||||||||||||
4392 | } | - | ||||||||||||
4393 | - | |||||||||||||
4394 | /*! | - | ||||||||||||
4395 | Returns the current state of this touch point. | - | ||||||||||||
4396 | */ | - | ||||||||||||
4397 | Qt::TouchPointState QTouchEvent::TouchPoint::state() const | - | ||||||||||||
4398 | { | - | ||||||||||||
4399 | return Qt::TouchPointState(int(d->state)); never executed: return Qt::TouchPointState(int(d->state)); | 0 | ||||||||||||
4400 | } | - | ||||||||||||
4401 | - | |||||||||||||
4402 | /*! | - | ||||||||||||
4403 | Returns the position of this touch point, relative to the widget | - | ||||||||||||
4404 | or QGraphicsItem that received the event. | - | ||||||||||||
4405 | - | |||||||||||||
4406 | \sa startPos(), lastPos(), screenPos(), scenePos(), normalizedPos() | - | ||||||||||||
4407 | */ | - | ||||||||||||
4408 | QPointF QTouchEvent::TouchPoint::pos() const | - | ||||||||||||
4409 | { | - | ||||||||||||
4410 | return d->rect.center(); never executed: return d->rect.center(); | 0 | ||||||||||||
4411 | } | - | ||||||||||||
4412 | - | |||||||||||||
4413 | /*! | - | ||||||||||||
4414 | Returns the scene position of this touch point. | - | ||||||||||||
4415 | - | |||||||||||||
4416 | The scene position is the position in QGraphicsScene coordinates | - | ||||||||||||
4417 | if the QTouchEvent is handled by a QGraphicsItem::touchEvent() | - | ||||||||||||
4418 | reimplementation, and identical to the screen position for | - | ||||||||||||
4419 | widgets. | - | ||||||||||||
4420 | - | |||||||||||||
4421 | \sa startScenePos(), lastScenePos(), pos() | - | ||||||||||||
4422 | */ | - | ||||||||||||
4423 | QPointF QTouchEvent::TouchPoint::scenePos() const | - | ||||||||||||
4424 | { | - | ||||||||||||
4425 | return d->sceneRect.center(); never executed: return d->sceneRect.center(); | 0 | ||||||||||||
4426 | } | - | ||||||||||||
4427 | - | |||||||||||||
4428 | /*! | - | ||||||||||||
4429 | Returns the screen position of this touch point. | - | ||||||||||||
4430 | - | |||||||||||||
4431 | \sa startScreenPos(), lastScreenPos(), pos() | - | ||||||||||||
4432 | */ | - | ||||||||||||
4433 | QPointF QTouchEvent::TouchPoint::screenPos() const | - | ||||||||||||
4434 | { | - | ||||||||||||
4435 | return d->screenRect.center(); never executed: return d->screenRect.center(); | 0 | ||||||||||||
4436 | } | - | ||||||||||||
4437 | - | |||||||||||||
4438 | /*! | - | ||||||||||||
4439 | Returns the normalized position of this touch point. | - | ||||||||||||
4440 | - | |||||||||||||
4441 | The coordinates are normalized to the size of the touch device, | - | ||||||||||||
4442 | i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner. | - | ||||||||||||
4443 | - | |||||||||||||
4444 | \sa startNormalizedPos(), lastNormalizedPos(), pos() | - | ||||||||||||
4445 | */ | - | ||||||||||||
4446 | QPointF QTouchEvent::TouchPoint::normalizedPos() const | - | ||||||||||||
4447 | { | - | ||||||||||||
4448 | return d->normalizedPos; never executed: return d->normalizedPos; | 0 | ||||||||||||
4449 | } | - | ||||||||||||
4450 | - | |||||||||||||
4451 | /*! | - | ||||||||||||
4452 | Returns the starting position of this touch point, relative to the | - | ||||||||||||
4453 | widget or QGraphicsItem that received the event. | - | ||||||||||||
4454 | - | |||||||||||||
4455 | \sa pos(), lastPos() | - | ||||||||||||
4456 | */ | - | ||||||||||||
4457 | QPointF QTouchEvent::TouchPoint::startPos() const | - | ||||||||||||
4458 | { | - | ||||||||||||
4459 | return d->startPos; never executed: return d->startPos; | 0 | ||||||||||||
4460 | } | - | ||||||||||||
4461 | - | |||||||||||||
4462 | /*! | - | ||||||||||||
4463 | Returns the starting scene position of this touch point. | - | ||||||||||||
4464 | - | |||||||||||||
4465 | The scene position is the position in QGraphicsScene coordinates | - | ||||||||||||
4466 | if the QTouchEvent is handled by a QGraphicsItem::touchEvent() | - | ||||||||||||
4467 | reimplementation, and identical to the screen position for | - | ||||||||||||
4468 | widgets. | - | ||||||||||||
4469 | - | |||||||||||||
4470 | \sa scenePos(), lastScenePos() | - | ||||||||||||
4471 | */ | - | ||||||||||||
4472 | QPointF QTouchEvent::TouchPoint::startScenePos() const | - | ||||||||||||
4473 | { | - | ||||||||||||
4474 | return d->startScenePos; never executed: return d->startScenePos; | 0 | ||||||||||||
4475 | } | - | ||||||||||||
4476 | - | |||||||||||||
4477 | /*! | - | ||||||||||||
4478 | Returns the starting screen position of this touch point. | - | ||||||||||||
4479 | - | |||||||||||||
4480 | \sa screenPos(), lastScreenPos() | - | ||||||||||||
4481 | */ | - | ||||||||||||
4482 | QPointF QTouchEvent::TouchPoint::startScreenPos() const | - | ||||||||||||
4483 | { | - | ||||||||||||
4484 | return d->startScreenPos; never executed: return d->startScreenPos; | 0 | ||||||||||||
4485 | } | - | ||||||||||||
4486 | - | |||||||||||||
4487 | /*! | - | ||||||||||||
4488 | Returns the normalized starting position of this touch point. | - | ||||||||||||
4489 | - | |||||||||||||
4490 | The coordinates are normalized to the size of the touch device, | - | ||||||||||||
4491 | i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner. | - | ||||||||||||
4492 | - | |||||||||||||
4493 | \sa normalizedPos(), lastNormalizedPos() | - | ||||||||||||
4494 | */ | - | ||||||||||||
4495 | QPointF QTouchEvent::TouchPoint::startNormalizedPos() const | - | ||||||||||||
4496 | { | - | ||||||||||||
4497 | return d->startNormalizedPos; never executed: return d->startNormalizedPos; | 0 | ||||||||||||
4498 | } | - | ||||||||||||
4499 | - | |||||||||||||
4500 | /*! | - | ||||||||||||
4501 | Returns the position of this touch point from the previous touch | - | ||||||||||||
4502 | event, relative to the widget or QGraphicsItem that received the event. | - | ||||||||||||
4503 | - | |||||||||||||
4504 | \sa pos(), startPos() | - | ||||||||||||
4505 | */ | - | ||||||||||||
4506 | QPointF QTouchEvent::TouchPoint::lastPos() const | - | ||||||||||||
4507 | { | - | ||||||||||||
4508 | return d->lastPos; never executed: return d->lastPos; | 0 | ||||||||||||
4509 | } | - | ||||||||||||
4510 | - | |||||||||||||
4511 | /*! | - | ||||||||||||
4512 | Returns the scene position of this touch point from the previous | - | ||||||||||||
4513 | touch event. | - | ||||||||||||
4514 | - | |||||||||||||
4515 | The scene position is the position in QGraphicsScene coordinates | - | ||||||||||||
4516 | if the QTouchEvent is handled by a QGraphicsItem::touchEvent() | - | ||||||||||||
4517 | reimplementation, and identical to the screen position for | - | ||||||||||||
4518 | widgets. | - | ||||||||||||
4519 | - | |||||||||||||
4520 | \sa scenePos(), startScenePos() | - | ||||||||||||
4521 | */ | - | ||||||||||||
4522 | QPointF QTouchEvent::TouchPoint::lastScenePos() const | - | ||||||||||||
4523 | { | - | ||||||||||||
4524 | return d->lastScenePos; never executed: return d->lastScenePos; | 0 | ||||||||||||
4525 | } | - | ||||||||||||
4526 | - | |||||||||||||
4527 | /*! | - | ||||||||||||
4528 | Returns the screen position of this touch point from the previous | - | ||||||||||||
4529 | touch event. | - | ||||||||||||
4530 | - | |||||||||||||
4531 | \sa screenPos(), startScreenPos() | - | ||||||||||||
4532 | */ | - | ||||||||||||
4533 | QPointF QTouchEvent::TouchPoint::lastScreenPos() const | - | ||||||||||||
4534 | { | - | ||||||||||||
4535 | return d->lastScreenPos; never executed: return d->lastScreenPos; | 0 | ||||||||||||
4536 | } | - | ||||||||||||
4537 | - | |||||||||||||
4538 | /*! | - | ||||||||||||
4539 | Returns the normalized position of this touch point from the | - | ||||||||||||
4540 | previous touch event. | - | ||||||||||||
4541 | - | |||||||||||||
4542 | The coordinates are normalized to the size of the touch device, | - | ||||||||||||
4543 | i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner. | - | ||||||||||||
4544 | - | |||||||||||||
4545 | \sa normalizedPos(), startNormalizedPos() | - | ||||||||||||
4546 | */ | - | ||||||||||||
4547 | QPointF QTouchEvent::TouchPoint::lastNormalizedPos() const | - | ||||||||||||
4548 | { | - | ||||||||||||
4549 | return d->lastNormalizedPos; never executed: return d->lastNormalizedPos; | 0 | ||||||||||||
4550 | } | - | ||||||||||||
4551 | - | |||||||||||||
4552 | /*! | - | ||||||||||||
4553 | Returns the rect for this touch point, relative to the widget | - | ||||||||||||
4554 | or QGraphicsItem that received the event. The rect is centered | - | ||||||||||||
4555 | around the point returned by pos(). | - | ||||||||||||
4556 | - | |||||||||||||
4557 | \note This function returns an empty rect if the device does not report touch point sizes. | - | ||||||||||||
4558 | */ | - | ||||||||||||
4559 | QRectF QTouchEvent::TouchPoint::rect() const | - | ||||||||||||
4560 | { | - | ||||||||||||
4561 | return d->rect; never executed: return d->rect; | 0 | ||||||||||||
4562 | } | - | ||||||||||||
4563 | - | |||||||||||||
4564 | /*! | - | ||||||||||||
4565 | Returns the rect for this touch point in scene coordinates. | - | ||||||||||||
4566 | - | |||||||||||||
4567 | \note This function returns an empty rect if the device does not report touch point sizes. | - | ||||||||||||
4568 | - | |||||||||||||
4569 | \sa scenePos(), rect() | - | ||||||||||||
4570 | */ | - | ||||||||||||
4571 | QRectF QTouchEvent::TouchPoint::sceneRect() const | - | ||||||||||||
4572 | { | - | ||||||||||||
4573 | return d->sceneRect; never executed: return d->sceneRect; | 0 | ||||||||||||
4574 | } | - | ||||||||||||
4575 | - | |||||||||||||
4576 | /*! | - | ||||||||||||
4577 | Returns the rect for this touch point in screen coordinates. | - | ||||||||||||
4578 | - | |||||||||||||
4579 | \note This function returns an empty rect if the device does not report touch point sizes. | - | ||||||||||||
4580 | - | |||||||||||||
4581 | \sa screenPos(), rect() | - | ||||||||||||
4582 | */ | - | ||||||||||||
4583 | QRectF QTouchEvent::TouchPoint::screenRect() const | - | ||||||||||||
4584 | { | - | ||||||||||||
4585 | return d->screenRect; never executed: return d->screenRect; | 0 | ||||||||||||
4586 | } | - | ||||||||||||
4587 | - | |||||||||||||
4588 | /*! | - | ||||||||||||
4589 | Returns the pressure of this touch point. The return value is in | - | ||||||||||||
4590 | the range 0.0 to 1.0. | - | ||||||||||||
4591 | */ | - | ||||||||||||
4592 | qreal QTouchEvent::TouchPoint::pressure() const | - | ||||||||||||
4593 | { | - | ||||||||||||
4594 | return d->pressure; never executed: return d->pressure; | 0 | ||||||||||||
4595 | } | - | ||||||||||||
4596 | - | |||||||||||||
4597 | /*! | - | ||||||||||||
4598 | Returns a velocity vector for this touch point. | - | ||||||||||||
4599 | The vector is in the screen's coordinate system, using pixels per seconds for the magnitude. | - | ||||||||||||
4600 | - | |||||||||||||
4601 | \note The returned vector is only valid if the touch device's capabilities include QTouchDevice::Velocity. | - | ||||||||||||
4602 | - | |||||||||||||
4603 | \sa QTouchDevice::capabilities(), device() | - | ||||||||||||
4604 | */ | - | ||||||||||||
4605 | QVector2D QTouchEvent::TouchPoint::velocity() const | - | ||||||||||||
4606 | { | - | ||||||||||||
4607 | return d->velocity; never executed: return d->velocity; | 0 | ||||||||||||
4608 | } | - | ||||||||||||
4609 | - | |||||||||||||
4610 | /*! | - | ||||||||||||
4611 | Returns additional information about the touch point. | - | ||||||||||||
4612 | - | |||||||||||||
4613 | \sa QTouchEvent::TouchPoint::InfoFlags | - | ||||||||||||
4614 | */ | - | ||||||||||||
4615 | QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const | - | ||||||||||||
4616 | { | - | ||||||||||||
4617 | return d->flags; never executed: return d->flags; | 0 | ||||||||||||
4618 | } | - | ||||||||||||
4619 | - | |||||||||||||
4620 | /*! | - | ||||||||||||
4621 | \since 5.0 | - | ||||||||||||
4622 | Returns the raw, unfiltered positions for the touch point. The positions are in native screen coordinates. | - | ||||||||||||
4623 | To get local coordinates you can use mapFromGlobal() of the QWindow returned by QTouchEvent::window(). | - | ||||||||||||
4624 | - | |||||||||||||
4625 | \note Returns an empty vector if the touch device's capabilities do not include QTouchDevice::RawPositions. | - | ||||||||||||
4626 | - | |||||||||||||
4627 | \note Native screen coordinates refer to the native orientation of the screen which, in case of | - | ||||||||||||
4628 | mobile devices, is typically portrait. This means that on systems capable of screen orientation | - | ||||||||||||
4629 | changes the positions in this list will not reflect the current orientation (unlike pos(), | - | ||||||||||||
4630 | screenPos(), etc.) and will always be reported in the native orientation. | - | ||||||||||||
4631 | - | |||||||||||||
4632 | \sa QTouchDevice::capabilities(), device(), window() | - | ||||||||||||
4633 | */ | - | ||||||||||||
4634 | QVector<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const | - | ||||||||||||
4635 | { | - | ||||||||||||
4636 | return d->rawScreenPositions; never executed: return d->rawScreenPositions; | 0 | ||||||||||||
4637 | } | - | ||||||||||||
4638 | - | |||||||||||||
4639 | /*! \internal */ | - | ||||||||||||
4640 | void QTouchEvent::TouchPoint::setId(int id) | - | ||||||||||||
4641 | { | - | ||||||||||||
4642 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4643 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4644 | d->id = id; | - | ||||||||||||
4645 | } never executed: end of block | 0 | ||||||||||||
4646 | - | |||||||||||||
4647 | /*! \internal */ | - | ||||||||||||
4648 | void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state) | - | ||||||||||||
4649 | { | - | ||||||||||||
4650 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4651 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4652 | d->state = state; | - | ||||||||||||
4653 | } never executed: end of block | 0 | ||||||||||||
4654 | - | |||||||||||||
4655 | /*! \internal */ | - | ||||||||||||
4656 | void QTouchEvent::TouchPoint::setPos(const QPointF &pos) | - | ||||||||||||
4657 | { | - | ||||||||||||
4658 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4659 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4660 | d->rect.moveCenter(pos); | - | ||||||||||||
4661 | } never executed: end of block | 0 | ||||||||||||
4662 | - | |||||||||||||
4663 | /*! \internal */ | - | ||||||||||||
4664 | void QTouchEvent::TouchPoint::setScenePos(const QPointF &scenePos) | - | ||||||||||||
4665 | { | - | ||||||||||||
4666 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4667 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4668 | d->sceneRect.moveCenter(scenePos); | - | ||||||||||||
4669 | } never executed: end of block | 0 | ||||||||||||
4670 | - | |||||||||||||
4671 | /*! \internal */ | - | ||||||||||||
4672 | void QTouchEvent::TouchPoint::setScreenPos(const QPointF &screenPos) | - | ||||||||||||
4673 | { | - | ||||||||||||
4674 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4675 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4676 | d->screenRect.moveCenter(screenPos); | - | ||||||||||||
4677 | } never executed: end of block | 0 | ||||||||||||
4678 | - | |||||||||||||
4679 | /*! \internal */ | - | ||||||||||||
4680 | void QTouchEvent::TouchPoint::setNormalizedPos(const QPointF &normalizedPos) | - | ||||||||||||
4681 | { | - | ||||||||||||
4682 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4683 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4684 | d->normalizedPos = normalizedPos; | - | ||||||||||||
4685 | } never executed: end of block | 0 | ||||||||||||
4686 | - | |||||||||||||
4687 | /*! \internal */ | - | ||||||||||||
4688 | void QTouchEvent::TouchPoint::setStartPos(const QPointF &startPos) | - | ||||||||||||
4689 | { | - | ||||||||||||
4690 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4691 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4692 | d->startPos = startPos; | - | ||||||||||||
4693 | } never executed: end of block | 0 | ||||||||||||
4694 | - | |||||||||||||
4695 | /*! \internal */ | - | ||||||||||||
4696 | void QTouchEvent::TouchPoint::setStartScenePos(const QPointF &startScenePos) | - | ||||||||||||
4697 | { | - | ||||||||||||
4698 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4699 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4700 | d->startScenePos = startScenePos; | - | ||||||||||||
4701 | } never executed: end of block | 0 | ||||||||||||
4702 | - | |||||||||||||
4703 | /*! \internal */ | - | ||||||||||||
4704 | void QTouchEvent::TouchPoint::setStartScreenPos(const QPointF &startScreenPos) | - | ||||||||||||
4705 | { | - | ||||||||||||
4706 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4707 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4708 | d->startScreenPos = startScreenPos; | - | ||||||||||||
4709 | } never executed: end of block | 0 | ||||||||||||
4710 | - | |||||||||||||
4711 | /*! \internal */ | - | ||||||||||||
4712 | void QTouchEvent::TouchPoint::setStartNormalizedPos(const QPointF &startNormalizedPos) | - | ||||||||||||
4713 | { | - | ||||||||||||
4714 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4715 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4716 | d->startNormalizedPos = startNormalizedPos; | - | ||||||||||||
4717 | } never executed: end of block | 0 | ||||||||||||
4718 | - | |||||||||||||
4719 | /*! \internal */ | - | ||||||||||||
4720 | void QTouchEvent::TouchPoint::setLastPos(const QPointF &lastPos) | - | ||||||||||||
4721 | { | - | ||||||||||||
4722 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4723 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4724 | d->lastPos = lastPos; | - | ||||||||||||
4725 | } never executed: end of block | 0 | ||||||||||||
4726 | - | |||||||||||||
4727 | /*! \internal */ | - | ||||||||||||
4728 | void QTouchEvent::TouchPoint::setLastScenePos(const QPointF &lastScenePos) | - | ||||||||||||
4729 | { | - | ||||||||||||
4730 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4731 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4732 | d->lastScenePos = lastScenePos; | - | ||||||||||||
4733 | } never executed: end of block | 0 | ||||||||||||
4734 | - | |||||||||||||
4735 | /*! \internal */ | - | ||||||||||||
4736 | void QTouchEvent::TouchPoint::setLastScreenPos(const QPointF &lastScreenPos) | - | ||||||||||||
4737 | { | - | ||||||||||||
4738 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4739 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4740 | d->lastScreenPos = lastScreenPos; | - | ||||||||||||
4741 | } never executed: end of block | 0 | ||||||||||||
4742 | - | |||||||||||||
4743 | /*! \internal */ | - | ||||||||||||
4744 | void QTouchEvent::TouchPoint::setLastNormalizedPos(const QPointF &lastNormalizedPos) | - | ||||||||||||
4745 | { | - | ||||||||||||
4746 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4747 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4748 | d->lastNormalizedPos = lastNormalizedPos; | - | ||||||||||||
4749 | } never executed: end of block | 0 | ||||||||||||
4750 | - | |||||||||||||
4751 | /*! \internal */ | - | ||||||||||||
4752 | void QTouchEvent::TouchPoint::setRect(const QRectF &rect) | - | ||||||||||||
4753 | { | - | ||||||||||||
4754 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4755 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4756 | d->rect = rect; | - | ||||||||||||
4757 | } never executed: end of block | 0 | ||||||||||||
4758 | - | |||||||||||||
4759 | /*! \internal */ | - | ||||||||||||
4760 | void QTouchEvent::TouchPoint::setSceneRect(const QRectF &sceneRect) | - | ||||||||||||
4761 | { | - | ||||||||||||
4762 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4763 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4764 | d->sceneRect = sceneRect; | - | ||||||||||||
4765 | } never executed: end of block | 0 | ||||||||||||
4766 | - | |||||||||||||
4767 | /*! \internal */ | - | ||||||||||||
4768 | void QTouchEvent::TouchPoint::setScreenRect(const QRectF &screenRect) | - | ||||||||||||
4769 | { | - | ||||||||||||
4770 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4771 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4772 | d->screenRect = screenRect; | - | ||||||||||||
4773 | } never executed: end of block | 0 | ||||||||||||
4774 | - | |||||||||||||
4775 | /*! \internal */ | - | ||||||||||||
4776 | void QTouchEvent::TouchPoint::setPressure(qreal pressure) | - | ||||||||||||
4777 | { | - | ||||||||||||
4778 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4779 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4780 | d->pressure = pressure; | - | ||||||||||||
4781 | } never executed: end of block | 0 | ||||||||||||
4782 | - | |||||||||||||
4783 | /*! \internal */ | - | ||||||||||||
4784 | void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v) | - | ||||||||||||
4785 | { | - | ||||||||||||
4786 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4787 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4788 | d->velocity = v; | - | ||||||||||||
4789 | } never executed: end of block | 0 | ||||||||||||
4790 | - | |||||||||||||
4791 | /*! \internal */ | - | ||||||||||||
4792 | void QTouchEvent::TouchPoint::setRawScreenPositions(const QVector<QPointF> &positions) | - | ||||||||||||
4793 | { | - | ||||||||||||
4794 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4795 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4796 | d->rawScreenPositions = positions; | - | ||||||||||||
4797 | } never executed: end of block | 0 | ||||||||||||
4798 | - | |||||||||||||
4799 | /*! | - | ||||||||||||
4800 | \internal | - | ||||||||||||
4801 | */ | - | ||||||||||||
4802 | void QTouchEvent::TouchPoint::setFlags(InfoFlags flags) | - | ||||||||||||
4803 | { | - | ||||||||||||
4804 | if (d->ref.load() != 1)
| 0 | ||||||||||||
4805 | d = d->detach(); never executed: d = d->detach(); | 0 | ||||||||||||
4806 | d->flags = flags; | - | ||||||||||||
4807 | } never executed: end of block | 0 | ||||||||||||
4808 | - | |||||||||||||
4809 | /*! | - | ||||||||||||
4810 | \fn TouchPoint &TouchPoint::operator=(const TouchPoint &other) | - | ||||||||||||
4811 | \internal | - | ||||||||||||
4812 | */ | - | ||||||||||||
4813 | - | |||||||||||||
4814 | /*! | - | ||||||||||||
4815 | \fn TouchPoint &TouchPoint::operator=(TouchPoint &&other) | - | ||||||||||||
4816 | \internal | - | ||||||||||||
4817 | */ | - | ||||||||||||
4818 | /*! | - | ||||||||||||
4819 | \fn void QTouchEvent::TouchPoint::swap(TouchPoint &other); | - | ||||||||||||
4820 | \internal | - | ||||||||||||
4821 | */ | - | ||||||||||||
4822 | - | |||||||||||||
4823 | /*! | - | ||||||||||||
4824 | \class QScrollPrepareEvent | - | ||||||||||||
4825 | \since 4.8 | - | ||||||||||||
4826 | \ingroup events | - | ||||||||||||
4827 | \inmodule QtGui | - | ||||||||||||
4828 | - | |||||||||||||
4829 | \brief The QScrollPrepareEvent class is sent in preparation of scrolling. | - | ||||||||||||
4830 | - | |||||||||||||
4831 | The scroll prepare event is sent before scrolling (usually by QScroller) is started. | - | ||||||||||||
4832 | The object receiving this event should set viewportSize, maxContentPos and contentPos. | - | ||||||||||||
4833 | It also should accept this event to indicate that scrolling should be started. | - | ||||||||||||
4834 | - | |||||||||||||
4835 | It is not guaranteed that a QScrollEvent will be sent after an acceepted | - | ||||||||||||
4836 | QScrollPrepareEvent, e.g. in a case where the maximum content position is (0,0). | - | ||||||||||||
4837 | - | |||||||||||||
4838 | \sa QScrollEvent, QScroller | - | ||||||||||||
4839 | */ | - | ||||||||||||
4840 | - | |||||||||||||
4841 | /*! | - | ||||||||||||
4842 | Creates new QScrollPrepareEvent | - | ||||||||||||
4843 | The \a startPos is the position of a touch or mouse event that started the scrolling. | - | ||||||||||||
4844 | */ | - | ||||||||||||
4845 | QScrollPrepareEvent::QScrollPrepareEvent(const QPointF &startPos) | - | ||||||||||||
4846 | : QEvent(QEvent::ScrollPrepare), m_target(0), m_startPos(startPos) | - | ||||||||||||
4847 | { | - | ||||||||||||
4848 | Q_UNUSED(m_target); | - | ||||||||||||
4849 | } never executed: end of block | 0 | ||||||||||||
4850 | - | |||||||||||||
4851 | /*! | - | ||||||||||||
4852 | Destroys QScrollEvent. | - | ||||||||||||
4853 | */ | - | ||||||||||||
4854 | QScrollPrepareEvent::~QScrollPrepareEvent() | - | ||||||||||||
4855 | { | - | ||||||||||||
4856 | } | - | ||||||||||||
4857 | - | |||||||||||||
4858 | /*! | - | ||||||||||||
4859 | Returns the position of the touch or mouse event that started the scrolling. | - | ||||||||||||
4860 | */ | - | ||||||||||||
4861 | QPointF QScrollPrepareEvent::startPos() const | - | ||||||||||||
4862 | { | - | ||||||||||||
4863 | return m_startPos; never executed: return m_startPos; | 0 | ||||||||||||
4864 | } | - | ||||||||||||
4865 | - | |||||||||||||
4866 | /*! | - | ||||||||||||
4867 | Returns size of the area that is to be scrolled as set by setViewportSize | - | ||||||||||||
4868 | - | |||||||||||||
4869 | \sa setViewportSize() | - | ||||||||||||
4870 | */ | - | ||||||||||||
4871 | QSizeF QScrollPrepareEvent::viewportSize() const | - | ||||||||||||
4872 | { | - | ||||||||||||
4873 | return m_viewportSize; never executed: return m_viewportSize; | 0 | ||||||||||||
4874 | } | - | ||||||||||||
4875 | - | |||||||||||||
4876 | /*! | - | ||||||||||||
4877 | Returns the range of coordinates for the content as set by setContentPosRange(). | - | ||||||||||||
4878 | */ | - | ||||||||||||
4879 | QRectF QScrollPrepareEvent::contentPosRange() const | - | ||||||||||||
4880 | { | - | ||||||||||||
4881 | return m_contentPosRange; never executed: return m_contentPosRange; | 0 | ||||||||||||
4882 | } | - | ||||||||||||
4883 | - | |||||||||||||
4884 | /*! | - | ||||||||||||
4885 | Returns the current position of the content as set by setContentPos. | - | ||||||||||||
4886 | */ | - | ||||||||||||
4887 | QPointF QScrollPrepareEvent::contentPos() const | - | ||||||||||||
4888 | { | - | ||||||||||||
4889 | return m_contentPos; never executed: return m_contentPos; | 0 | ||||||||||||
4890 | } | - | ||||||||||||
4891 | - | |||||||||||||
4892 | - | |||||||||||||
4893 | /*! | - | ||||||||||||
4894 | Sets the size of the area that is to be scrolled to \a size. | - | ||||||||||||
4895 | - | |||||||||||||
4896 | \sa viewportSize() | - | ||||||||||||
4897 | */ | - | ||||||||||||
4898 | void QScrollPrepareEvent::setViewportSize(const QSizeF &size) | - | ||||||||||||
4899 | { | - | ||||||||||||
4900 | m_viewportSize = size; | - | ||||||||||||
4901 | } never executed: end of block | 0 | ||||||||||||
4902 | - | |||||||||||||
4903 | /*! | - | ||||||||||||
4904 | Sets the range of content coordinates to \a rect. | - | ||||||||||||
4905 | - | |||||||||||||
4906 | \sa contentPosRange() | - | ||||||||||||
4907 | */ | - | ||||||||||||
4908 | void QScrollPrepareEvent::setContentPosRange(const QRectF &rect) | - | ||||||||||||
4909 | { | - | ||||||||||||
4910 | m_contentPosRange = rect; | - | ||||||||||||
4911 | } never executed: end of block | 0 | ||||||||||||
4912 | - | |||||||||||||
4913 | /*! | - | ||||||||||||
4914 | Sets the current content position to \a pos. | - | ||||||||||||
4915 | - | |||||||||||||
4916 | \sa contentPos() | - | ||||||||||||
4917 | */ | - | ||||||||||||
4918 | void QScrollPrepareEvent::setContentPos(const QPointF &pos) | - | ||||||||||||
4919 | { | - | ||||||||||||
4920 | m_contentPos = pos; | - | ||||||||||||
4921 | } never executed: end of block | 0 | ||||||||||||
4922 | - | |||||||||||||
4923 | - | |||||||||||||
4924 | /*! | - | ||||||||||||
4925 | \class QScrollEvent | - | ||||||||||||
4926 | \since 4.8 | - | ||||||||||||
4927 | \ingroup events | - | ||||||||||||
4928 | \inmodule QtGui | - | ||||||||||||
4929 | - | |||||||||||||
4930 | \brief The QScrollEvent class is sent when scrolling. | - | ||||||||||||
4931 | - | |||||||||||||
4932 | The scroll event is sent to indicate that the receiver should be scrolled. | - | ||||||||||||
4933 | Usually the receiver should be something visual like QWidget or QGraphicsObject. | - | ||||||||||||
4934 | - | |||||||||||||
4935 | Some care should be taken that no conflicting QScrollEvents are sent from two | - | ||||||||||||
4936 | sources. Using QScroller::scrollTo is save however. | - | ||||||||||||
4937 | - | |||||||||||||
4938 | \sa QScrollPrepareEvent, QScroller | - | ||||||||||||
4939 | */ | - | ||||||||||||
4940 | - | |||||||||||||
4941 | /*! | - | ||||||||||||
4942 | \enum QScrollEvent::ScrollState | - | ||||||||||||
4943 | - | |||||||||||||
4944 | This enum describes the states a scroll event can have. | - | ||||||||||||
4945 | - | |||||||||||||
4946 | \value ScrollStarted Set for the first scroll event of a scroll activity. | - | ||||||||||||
4947 | - | |||||||||||||
4948 | \value ScrollUpdated Set for all but the first and the last scroll event of a scroll activity. | - | ||||||||||||
4949 | - | |||||||||||||
4950 | \value ScrollFinished Set for the last scroll event of a scroll activity. | - | ||||||||||||
4951 | - | |||||||||||||
4952 | \sa QScrollEvent::scrollState() | - | ||||||||||||
4953 | */ | - | ||||||||||||
4954 | - | |||||||||||||
4955 | /*! | - | ||||||||||||
4956 | Creates a new QScrollEvent | - | ||||||||||||
4957 | \a contentPos is the new content position, \a overshootDistance is the | - | ||||||||||||
4958 | new overshoot distance while \a scrollState indicates if this scroll | - | ||||||||||||
4959 | event is the first one, the last one or some event in between. | - | ||||||||||||
4960 | */ | - | ||||||||||||
4961 | QScrollEvent::QScrollEvent(const QPointF &contentPos, const QPointF &overshootDistance, ScrollState scrollState) | - | ||||||||||||
4962 | : QEvent(QEvent::Scroll), m_contentPos(contentPos), m_overshoot(overshootDistance), m_state(scrollState) | - | ||||||||||||
4963 | { | - | ||||||||||||
4964 | } never executed: end of block | 0 | ||||||||||||
4965 | - | |||||||||||||
4966 | /*! | - | ||||||||||||
4967 | Destroys QScrollEvent. | - | ||||||||||||
4968 | */ | - | ||||||||||||
4969 | QScrollEvent::~QScrollEvent() | - | ||||||||||||
4970 | { | - | ||||||||||||
4971 | } | - | ||||||||||||
4972 | - | |||||||||||||
4973 | /*! | - | ||||||||||||
4974 | Returns the new scroll position. | - | ||||||||||||
4975 | */ | - | ||||||||||||
4976 | QPointF QScrollEvent::contentPos() const | - | ||||||||||||
4977 | { | - | ||||||||||||
4978 | return m_contentPos; never executed: return m_contentPos; | 0 | ||||||||||||
4979 | } | - | ||||||||||||
4980 | - | |||||||||||||
4981 | /*! | - | ||||||||||||
4982 | Returns the new overshoot distance. | - | ||||||||||||
4983 | See QScroller for an explanation of the term overshoot. | - | ||||||||||||
4984 | - | |||||||||||||
4985 | \sa QScroller | - | ||||||||||||
4986 | */ | - | ||||||||||||
4987 | QPointF QScrollEvent::overshootDistance() const | - | ||||||||||||
4988 | { | - | ||||||||||||
4989 | return m_overshoot; never executed: return m_overshoot; | 0 | ||||||||||||
4990 | } | - | ||||||||||||
4991 | - | |||||||||||||
4992 | /*! | - | ||||||||||||
4993 | Returns the current scroll state as a combination of ScrollStateFlag values. | - | ||||||||||||
4994 | ScrollStarted (or ScrollFinished) will be set, if this scroll event is the first (or last) event in a scrolling activity. | - | ||||||||||||
4995 | Please note that both values can be set at the same time, if the activity consists of a single QScrollEvent. | - | ||||||||||||
4996 | All other scroll events in between will have their state set to ScrollUpdated. | - | ||||||||||||
4997 | - | |||||||||||||
4998 | A widget could for example revert selections when scrolling is started and stopped. | - | ||||||||||||
4999 | */ | - | ||||||||||||
5000 | QScrollEvent::ScrollState QScrollEvent::scrollState() const | - | ||||||||||||
5001 | { | - | ||||||||||||
5002 | return m_state; never executed: return m_state; | 0 | ||||||||||||
5003 | } | - | ||||||||||||
5004 | - | |||||||||||||
5005 | /*! | - | ||||||||||||
5006 | Creates a new QScreenOrientationChangeEvent | - | ||||||||||||
5007 | \a orientation is the new orientation of the screen. | - | ||||||||||||
5008 | */ | - | ||||||||||||
5009 | QScreenOrientationChangeEvent::QScreenOrientationChangeEvent(QScreen *screen, Qt::ScreenOrientation screenOrientation) | - | ||||||||||||
5010 | : QEvent(QEvent::OrientationChange), m_screen(screen), m_orientation(screenOrientation) | - | ||||||||||||
5011 | { | - | ||||||||||||
5012 | } never executed: end of block | 0 | ||||||||||||
5013 | - | |||||||||||||
5014 | /*! | - | ||||||||||||
5015 | Destroys QScreenOrientationChangeEvent. | - | ||||||||||||
5016 | */ | - | ||||||||||||
5017 | QScreenOrientationChangeEvent::~QScreenOrientationChangeEvent() | - | ||||||||||||
5018 | { | - | ||||||||||||
5019 | } | - | ||||||||||||
5020 | - | |||||||||||||
5021 | /*! | - | ||||||||||||
5022 | Returns the screen whose orientation changed. | - | ||||||||||||
5023 | */ | - | ||||||||||||
5024 | QScreen *QScreenOrientationChangeEvent::screen() const | - | ||||||||||||
5025 | { | - | ||||||||||||
5026 | return m_screen; never executed: return m_screen; | 0 | ||||||||||||
5027 | } | - | ||||||||||||
5028 | - | |||||||||||||
5029 | /*! | - | ||||||||||||
5030 | Returns the orientation of the screen. | - | ||||||||||||
5031 | */ | - | ||||||||||||
5032 | Qt::ScreenOrientation QScreenOrientationChangeEvent::orientation() const | - | ||||||||||||
5033 | { | - | ||||||||||||
5034 | return m_orientation; never executed: return m_orientation; | 0 | ||||||||||||
5035 | } | - | ||||||||||||
5036 | - | |||||||||||||
5037 | /*! | - | ||||||||||||
5038 | Creates a new QApplicationStateChangeEvent. | - | ||||||||||||
5039 | \a applicationState is the new state. | - | ||||||||||||
5040 | */ | - | ||||||||||||
5041 | QApplicationStateChangeEvent::QApplicationStateChangeEvent(Qt::ApplicationState applicationState) | - | ||||||||||||
5042 | : QEvent(QEvent::ApplicationStateChange), m_applicationState(applicationState) | - | ||||||||||||
5043 | { | - | ||||||||||||
5044 | } never executed: end of block | 0 | ||||||||||||
5045 | - | |||||||||||||
5046 | /*! | - | ||||||||||||
5047 | Returns the state of the application. | - | ||||||||||||
5048 | */ | - | ||||||||||||
5049 | Qt::ApplicationState QApplicationStateChangeEvent::applicationState() const | - | ||||||||||||
5050 | { | - | ||||||||||||
5051 | return m_applicationState; never executed: return m_applicationState; | 0 | ||||||||||||
5052 | } | - | ||||||||||||
5053 | - | |||||||||||||
5054 | QT_END_NAMESPACE | - | ||||||||||||
Source code | Switch to Preprocessed file |