OpenCoverage

qevent.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qevent.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtGui module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
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 https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://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 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qevent.h"-
41#include "qcursor.h"-
42#include "private/qguiapplication_p.h"-
43#include "qpa/qplatformintegration.h"-
44#include "qpa/qplatformdrag.h"-
45#include "private/qevent_p.h"-
46#include "qfile.h"-
47#include "qmetaobject.h"-
48#include "qmimedata.h"-
49#include "private/qdnd_p.h"-
50#include "qevent_p.h"-
51#include "qmath.h"-
52-
53#include <private/qdebug_p.h>-
54-
55QT_BEGIN_NAMESPACE-
56-
57/*!-
58 \class QEnterEvent-
59 \ingroup events-
60 \inmodule QtGui-
61-
62 \brief The QEnterEvent class contains parameters that describe an enter event.-
63-
64 Enter events occur when the mouse cursor enters a window or a widget.-
65-
66 \since 5.0-
67*/-
68-
69/*!-
70 Constructs an enter event object.-
71-
72 The points \a localPos, \a windowPos and \a screenPos specify the-
73 mouse cursor's position relative to the receiving widget or item,-
74 window, and screen, respectively.-
75*/-
76-
77QEnterEvent::QEnterEvent(const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos)-
78 : QEvent(QEvent::Enter)-
79 , l(localPos)-
80 , w(windowPos)-
81 , s(screenPos)-
82{-
83}
never executed: end of block
0
84-
85/*!-
86 \internal-
87*/-
88QEnterEvent::~QEnterEvent()-
89{-
90}-
91-
92/*!-
93 \fn QPoint QEnterEvent::globalPos() const-
94-
95 Returns the global position of the widget \e{at the time of the event}.-
96*/-
97/*!-
98 \fn int QEnterEvent::globalX() const-
99-
100 Returns the global position on the X-axis of the mouse cursor relative to the the widget.-
101*/-
102/*!-
103 \fn int QEnterEvent::globalY() const-
104-
105 Returns the global position on the Y-axis of the mouse cursor relative to the the widget.-
106*/-
107/*!-
108 \fn QPoint QEnterEvent::localPos() const-
109-
110 Returns the mouse cursor's position relative to the receiving widget.-
111*/-
112/*!-
113 \fn QPoint QEnterEvent::pos() const-
114-
115 Returns the position of the mouse cursor in global screen coordinates.-
116*/-
117/*!-
118 \fn QPoint QEnterEvent::screenPos() const-
119-
120 Returns the position of the mouse cursor relative to the receiving screen.-
121*/-
122/*!-
123 \fn QPoint QEnterEvent::windowPos() const-
124-
125 Returns the position of the mouse cursor relative to the receiving window.-
126*/-
127/*!-
128 \fn int QEnterEvent::x() const-
129-
130 Returns the x position of the mouse cursor relative to the receiving widget.-
131*/-
132/*!-
133 \fn int QEnterEvent::y() const-
134-
135 Returns the y position of the mouse cursor relative to the receiving widget.-
136*/-
137-
138/*!-
139 \class QInputEvent-
140 \ingroup events-
141 \inmodule QtGui-
142-
143 \brief The QInputEvent class is the base class for events that-
144 describe user input.-
145*/-
146-
147/*!-
148 \internal-
149*/-
150QInputEvent::QInputEvent(Type type, Qt::KeyboardModifiers modifiers)-
151 : QEvent(type), modState(modifiers), ts(0)-
152{}
never executed: end of block
0
153-
154/*!-
155 \internal-
156*/-
157QInputEvent::~QInputEvent()-
158{-
159}-
160-
161/*!-
162 \fn Qt::KeyboardModifiers QInputEvent::modifiers() const-
163-
164 Returns the keyboard modifier flags that existed immediately-
165 before the event occurred.-
166-
167 \sa QGuiApplication::keyboardModifiers()-
168*/-
169-
170/*! \fn void QInputEvent::setModifiers(Qt::KeyboardModifiers modifiers)-
171-
172 \internal-
173-
174 Sets the keyboard modifiers flags for this event.-
175*/-
176-
177/*!-
178 \fn ulong QInputEvent::timestamp() const-
179-
180 Returns the window system's timestamp for this event.-
181 It will normally be in milliseconds since some arbitrary point-
182 in time, such as the time when the system was started.-
183*/-
184-
185/*! \fn void QInputEvent::setTimestamp(ulong atimestamp)-
186-
187 \internal-
188-
189 Sets the timestamp for this event.-
190*/-
191-
192/*!-
193 \class QMouseEvent-
194 \ingroup events-
195 \inmodule QtGui-
196-
197 \brief The QMouseEvent class contains parameters that describe a mouse event.-
198-
199 Mouse events occur when a mouse button is pressed or released-
200 inside a widget, or when the mouse cursor is moved.-
201-
202 Mouse move events will occur only when a mouse button is pressed-
203 down, unless mouse tracking has been enabled with-
204 QWidget::setMouseTracking().-
205-
206 Qt automatically grabs the mouse when a mouse button is pressed-
207 inside a widget; the widget will continue to receive mouse events-
208 until the last mouse button is released.-
209-
210 A mouse event contains a special accept flag that indicates-
211 whether the receiver wants the event. You should call ignore() if-
212 the mouse event is not handled by your widget. A mouse event is-
213 propagated up the parent widget chain until a widget accepts it-
214 with accept(), or an event filter consumes it.-
215-
216 \note If a mouse event is propagated to a \l{QWidget}{widget} for-
217 which Qt::WA_NoMousePropagation has been set, that mouse event-
218 will not be propagated further up the parent widget chain.-
219-
220 The state of the keyboard modifier keys can be found by calling the-
221 \l{QInputEvent::modifiers()}{modifiers()} function, inherited from-
222 QInputEvent.-
223-
224 The functions pos(), x(), and y() give the cursor position-
225 relative to the widget that receives the mouse event. If you-
226 move the widget as a result of the mouse event, use the global-
227 position returned by globalPos() to avoid a shaking motion.-
228-
229 The QWidget::setEnabled() function can be used to enable or-
230 disable mouse and keyboard events for a widget.-
231-
232 Reimplement the QWidget event handlers, QWidget::mousePressEvent(),-
233 QWidget::mouseReleaseEvent(), QWidget::mouseDoubleClickEvent(),-
234 and QWidget::mouseMoveEvent() to receive mouse events in your own-
235 widgets.-
236-
237 \sa QWidget::setMouseTracking(), QWidget::grabMouse(),-
238 QCursor::pos()-
239*/-
240-
241/*!-
242 Constructs a mouse event object.-
243-
244 The \a type parameter must be one of QEvent::MouseButtonPress,-
245 QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick,-
246 or QEvent::MouseMove.-
247-
248 The \a localPos is the mouse cursor's position relative to the-
249 receiving widget or item. The window position is set to the same value-
250 as \a localPos.-
251 The \a button that caused the event is given as a value from-
252 the Qt::MouseButton enum. If the event \a type is-
253 \l MouseMove, the appropriate button for this event is Qt::NoButton.-
254 The mouse and keyboard states at the time of the event are specified by-
255 \a buttons and \a modifiers.-
256-
257 The screenPos() is initialized to QCursor::pos(), which may not-
258 be appropriate. Use the other constructor to specify the global-
259 position explicitly.-
260*/-
261QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, Qt::MouseButton button,-
262 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)-
263 : QInputEvent(type, modifiers), l(localPos), w(localPos), b(button), mouseState(buttons), caps(0)-
264{-
265#ifndef QT_NO_CURSOR-
266 s = QCursor::pos();-
267#endif-
268}
never executed: end of block
0
269-
270-
271/*!-
272 Constructs a mouse event object.-
273-
274 The \a type parameter must be QEvent::MouseButtonPress,-
275 QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick,-
276 or QEvent::MouseMove.-
277-
278 The \a localPos is the mouse cursor's position relative to the-
279 receiving widget or item. The cursor's position in screen coordinates is-
280 specified by \a screenPos. The window position is set to the same value-
281 as \a localPos. The \a button that caused the event is-
282 given as a value from the \l Qt::MouseButton enum. If the event \a-
283 type is \l MouseMove, the appropriate button for this event is-
284 Qt::NoButton. \a buttons is the state of all buttons at the-
285 time of the event, \a modifiers the state of all keyboard-
286 modifiers.-
287-
288*/-
289QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &screenPos,-
290 Qt::MouseButton button, Qt::MouseButtons buttons,-
291 Qt::KeyboardModifiers modifiers)-
292 : QInputEvent(type, modifiers), l(localPos), w(localPos), s(screenPos), b(button), mouseState(buttons), caps(0)-
293{}
never executed: end of block
0
294-
295/*!-
296 Constructs a mouse event object.-
297-
298 The \a type parameter must be QEvent::MouseButtonPress,-
299 QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick,-
300 or QEvent::MouseMove.-
301-
302 The points \a localPos, \a windowPos and \a screenPos specify the-
303 mouse cursor's position relative to the receiving widget or item,-
304 window, and screen, respectively.-
305-
306 The \a button that caused the event is-
307 given as a value from the \l Qt::MouseButton enum. If the event \a-
308 type is \l MouseMove, the appropriate button for this event is-
309 Qt::NoButton. \a buttons is the state of all buttons at the-
310 time of the event, \a modifiers the state of all keyboard-
311 modifiers.-
312-
313*/-
314QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos,-
315 Qt::MouseButton button, Qt::MouseButtons buttons,-
316 Qt::KeyboardModifiers modifiers)-
317 : QInputEvent(type, modifiers), l(localPos), w(windowPos), s(screenPos), b(button), mouseState(buttons), caps(0)-
318{}
never executed: end of block
0
319-
320/*!-
321 \since 5.6-
322-
323 Constructs a mouse event object.-
324-
325 The \a type parameter must be QEvent::MouseButtonPress,-
326 QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick,-
327 or QEvent::MouseMove.-
328-
329 The points \a localPos, \a windowPos and \a screenPos specify the-
330 mouse cursor's position relative to the receiving widget or item,-
331 window, and screen, respectively.-
332-
333 The \a button that caused the event is given as a value from the-
334 \l Qt::MouseButton enum. If the event \a type is \l MouseMove,-
335 the appropriate button for this event is Qt::NoButton. \a buttons-
336 is the state of all buttons at the time of the event, \a modifiers-
337 is the state of all keyboard modifiers.-
338-
339 The source of the event is specified by \a source.-
340-
341*/-
342QMouseEvent::QMouseEvent(QEvent::Type type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos,-
343 Qt::MouseButton button, Qt::MouseButtons buttons,-
344 Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source)-
345 : QInputEvent(type, modifiers), l(localPos), w(windowPos), s(screenPos), b(button), mouseState(buttons), caps(0)-
346{-
347 QGuiApplicationPrivate::setMouseEventSource(this, source);-
348}
never executed: end of block
0
349-
350/*!-
351 \internal-
352*/-
353QMouseEvent::~QMouseEvent()-
354{-
355}-
356-
357/*!-
358 \since 5.3-
359-
360 Returns information about the mouse event source.-
361-
362 The mouse event source can be used to distinguish between genuine-
363 and artificial mouse events. The latter are events that are-
364 synthesized from touch events by the operating system or Qt itself.-
365-
366 \note Many platforms provide no such information. On such platforms-
367 \l Qt::MouseEventNotSynthesized is returned always.-
368-
369 \sa Qt::MouseEventSource-
370 \sa QGraphicsSceneMouseEvent::source()-
371 */-
372Qt::MouseEventSource QMouseEvent::source() const-
373{-
374 return QGuiApplicationPrivate::mouseEventSource(this);
never executed: return QGuiApplicationPrivate::mouseEventSource(this);
0
375}-
376-
377/*!-
378 \since 5.3-
379-
380 Returns the mouse event flags.-
381-
382 The mouse event flags provide additional information about a mouse event.-
383-
384 \sa Qt::MouseEventFlag-
385 \sa QGraphicsSceneMouseEvent::flags()-
386 */-
387Qt::MouseEventFlags QMouseEvent::flags() const-
388{-
389 return QGuiApplicationPrivate::mouseEventFlags(this);
never executed: return QGuiApplicationPrivate::mouseEventFlags(this);
0
390}-
391-
392/*!-
393 \fn QPointF QMouseEvent::localPos() const-
394-
395 \since 5.0-
396-
397 Returns the position of the mouse cursor as a QPointF, relative to the-
398 widget or item that received the event.-
399-
400 If you move the widget as a result of the mouse event, use the-
401 screen position returned by screenPos() to avoid a shaking-
402 motion.-
403-
404 \sa x(), y(), windowPos(), screenPos()-
405*/-
406-
407/*!-
408 \fn QPointF QMouseEvent::windowPos() const-
409-
410 \since 5.0-
411-
412 Returns the position of the mouse cursor as a QPointF, relative to the-
413 window that received the event.-
414-
415 If you move the widget as a result of the mouse event, use the-
416 global position returned by globalPos() to avoid a shaking-
417 motion.-
418-
419 \sa x(), y(), pos(), localPos(), screenPos()-
420*/-
421-
422/*!-
423 \fn QPointF QMouseEvent::screenPos() const-
424-
425 \since 5.0-
426-
427 Returns the position of the mouse cursor as a QPointF, relative to the-
428 screen that received the event.-
429-
430 \sa x(), y(), pos(), localPos(), windowPos()-
431*/-
432-
433/*!-
434 \fn QPoint QMouseEvent::pos() const-
435-
436 Returns the position of the mouse cursor, relative to the widget-
437 that received the event.-
438-
439 If you move the widget as a result of the mouse event, use the-
440 global position returned by globalPos() to avoid a shaking-
441 motion.-
442-
443 \sa x(), y(), globalPos()-
444*/-
445-
446/*!-
447 \fn QPoint QMouseEvent::globalPos() const-
448-
449 Returns the global position of the mouse cursor \e{at the time-
450 of the event}. This is important on asynchronous window systems-
451 like X11. Whenever you move your widgets around in response to-
452 mouse events, globalPos() may differ a lot from the current-
453 pointer position QCursor::pos(), and from-
454 QWidget::mapToGlobal(pos()).-
455-
456 \sa globalX(), globalY()-
457*/-
458-
459/*!-
460 \fn int QMouseEvent::x() const-
461-
462 Returns the x position of the mouse cursor, relative to the-
463 widget that received the event.-
464-
465 \sa y(), pos()-
466*/-
467-
468/*!-
469 \fn int QMouseEvent::y() const-
470-
471 Returns the y position of the mouse cursor, relative to the-
472 widget that received the event.-
473-
474 \sa x(), pos()-
475*/-
476-
477/*!-
478 \fn int QMouseEvent::globalX() const-
479-
480 Returns the global x position of the mouse cursor at the time of-
481 the event.-
482-
483 \sa globalY(), globalPos()-
484*/-
485-
486/*!-
487 \fn int QMouseEvent::globalY() const-
488-
489 Returns the global y position of the mouse cursor at the time of-
490 the event.-
491-
492 \sa globalX(), globalPos()-
493*/-
494-
495/*!-
496 \fn Qt::MouseButton QMouseEvent::button() const-
497-
498 Returns the button that caused the event.-
499-
500 Note that the returned value is always Qt::NoButton for mouse-
501 move events.-
502-
503 \sa buttons(), Qt::MouseButton-
504*/-
505-
506/*!-
507 \fn Qt::MouseButton QMouseEvent::buttons() const-
508-
509 Returns the button state when the event was generated. The button-
510 state is a combination of Qt::LeftButton, Qt::RightButton,-
511 Qt::MidButton using the OR operator. For mouse move events,-
512 this is all buttons that are pressed down. For mouse press and-
513 double click events this includes the button that caused the-
514 event. For mouse release events this excludes the button that-
515 caused the event.-
516-
517 \sa button(), Qt::MouseButton-
518*/-
519-
520/*!-
521 \fn QPointF QMouseEvent::posF() const-
522 \obsolete-
523-
524 Use localPos() instead.-
525*/-
526-
527/*!-
528 \class QHoverEvent-
529 \ingroup events-
530 \inmodule QtGui-
531-
532 \brief The QHoverEvent class contains parameters that describe a mouse event.-
533-
534 Mouse events occur when a mouse cursor is moved into, out of, or within a-
535 widget, and if the widget has the Qt::WA_Hover attribute.-
536-
537 The function pos() gives the current cursor position, while oldPos() gives-
538 the old mouse position.-
539-
540 There are a few similarities between the events QEvent::HoverEnter-
541 and QEvent::HoverLeave, and the events QEvent::Enter and QEvent::Leave.-
542 However, they are slightly different because we do an update() in the event-
543 handler of HoverEnter and HoverLeave.-
544-
545 QEvent::HoverMove is also slightly different from QEvent::MouseMove. Let us-
546 consider a top-level window A containing a child B which in turn contains a-
547 child C (all with mouse tracking enabled):-
548-
549 \image hoverevents.png-
550-
551 Now, if you move the cursor from the top to the bottom in the middle of A,-
552 you will get the following QEvent::MouseMove events:-
553-
554 \list 1-
555 \li A::MouseMove-
556 \li B::MouseMove-
557 \li C::MouseMove-
558 \endlist-
559-
560 You will get the same events for QEvent::HoverMove, except that the event-
561 always propagates to the top-level regardless whether the event is accepted-
562 or not. It will only stop propagating with the Qt::WA_NoMousePropagation-
563 attribute.-
564-
565 In this case the events will occur in the following way:-
566-
567 \list 1-
568 \li A::HoverMove-
569 \li A::HoverMove, B::HoverMove-
570 \li A::HoverMove, B::HoverMove, C::HoverMove-
571 \endlist-
572-
573*/-
574-
575/*!-
576 \fn QPoint QHoverEvent::pos() const-
577-
578 Returns the position of the mouse cursor, relative to the widget-
579 that received the event.-
580-
581 On QEvent::HoverLeave events, this position will always be-
582 QPoint(-1, -1).-
583-
584 \sa oldPos()-
585*/-
586-
587/*!-
588 \fn QPoint QHoverEvent::oldPos() const-
589-
590 Returns the previous position of the mouse cursor, relative to the widget-
591 that received the event. If there is no previous position, oldPos() will-
592 return the same position as pos().-
593-
594 On QEvent::HoverEnter events, this position will always be-
595 QPoint(-1, -1).-
596-
597 \sa pos()-
598*/-
599-
600/*!-
601 \fn const QPointF &QHoverEvent::posF() const-
602-
603 Returns the position of the mouse cursor, relative to the widget-
604 that received the event.-
605-
606 On QEvent::HoverLeave events, this position will always be-
607 QPointF(-1, -1).-
608-
609 \sa oldPosF()-
610*/-
611-
612/*!-
613 \fn const QPointF &QHoverEvent::oldPosF() const-
614-
615 Returns the previous position of the mouse cursor, relative to the widget-
616 that received the event. If there is no previous position, oldPosF() will-
617 return the same position as posF().-
618-
619 On QEvent::HoverEnter events, this position will always be-
620 QPointF(-1, -1).-
621-
622 \sa posF()-
623*/-
624-
625/*!-
626 Constructs a hover event object.-
627-
628 The \a type parameter must be QEvent::HoverEnter,-
629 QEvent::HoverLeave, or QEvent::HoverMove.-
630-
631 The \a pos is the current mouse cursor's position relative to the-
632 receiving widget, while \a oldPos is its previous such position.-
633 \a modifiers hold the state of all keyboard modifiers at the time-
634 of the event.-
635*/-
636QHoverEvent::QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos, Qt::KeyboardModifiers modifiers)-
637 : QInputEvent(type, modifiers), p(pos), op(oldPos)-
638{-
639}
never executed: end of block
0
640-
641/*!-
642 \internal-
643*/-
644QHoverEvent::~QHoverEvent()-
645{-
646}-
647-
648-
649/*!-
650 \class QWheelEvent-
651 \brief The QWheelEvent class contains parameters that describe a wheel event.-
652 \inmodule QtGui-
653-
654 \ingroup events-
655-
656 Wheel events are sent to the widget under the mouse cursor, but-
657 if that widget does not handle the event they are sent to the-
658 focus widget. Wheel events are generated for both mouse wheels-
659 and trackpad scroll gestures. There are two ways to read the-
660 wheel event delta: angleDelta() returns the delta in wheel-
661 degrees. This value is always provided. pixelDelta() returns-
662 the delta in screen pixels and is available on platforms that-
663 have high-resolution trackpads, such as \macos. If that is the-
664 case, source() will return Qt::MouseEventSynthesizedBySystem.-
665-
666 The functions pos() and globalPos() return the mouse cursor's-
667 location at the time of the event.-
668-
669 A wheel event contains a special accept flag that indicates-
670 whether the receiver wants the event. You should call ignore() if-
671 you do not handle the wheel event; this ensures that it will be-
672 sent to the parent widget.-
673-
674 The QWidget::setEnabled() function can be used to enable or-
675 disable mouse and keyboard events for a widget.-
676-
677 The event handler QWidget::wheelEvent() receives wheel events.-
678-
679 \sa QMouseEvent, QWidget::grabMouse()-
680*/-
681-
682/*!-
683 \fn Qt::MouseButtons QWheelEvent::buttons() const-
684-
685 Returns the mouse state when the event occurred.-
686*/-
687-
688/*!-
689 \fn Qt::MouseEventSource QWheelEvent::source() const-
690 \since 5.5-
691-
692 Returns information about the wheel event source.-
693-
694 The source can be used to distinguish between events that come from a mouse-
695 with a physical wheel and events that are generated by some other means,-
696 such as a flick gesture on a touchpad.-
697-
698 \note Many platforms provide no such information. On such platforms-
699 \l Qt::MouseEventNotSynthesized is returned always.-
700-
701 \sa Qt::MouseEventSource-
702*/-
703-
704/*!-
705 \fn bool QWheelEvent::inverted() const-
706 \since 5.7-
707-
708 Returns whether the delta values delivered with the event are inverted.-
709-
710 Normally, a vertical wheel will produce a QWheelEvent with positive delta-
711 values if the top of the wheel is rotating away from the hand operating it.-
712 Similarly, a horizontal wheel movement will produce a QWheelEvent with-
713 positive delta values if the top of the wheel is moved to the left.-
714-
715 However, on some platforms this is configurable, so that the same-
716 operations described above will produce negative delta values (but with the-
717 same magnitude). With the inverted property a wheel event consumer can-
718 choose to always follow the direction of the wheel, regardless of the-
719 system settings, but only for specific widgets. (One such use case could be-
720 that the user is rotating the wheel in the same direction as a visual-
721 Tumbler rotates. Another usecase is to make a slider handle follow the-
722 direction of movement of fingers on a touchpad regardless of system-
723 configuration.)-
724-
725 \note Many platforms provide no such information. On such platforms-
726 \l inverted always returns false.-
727*/-
728-
729/*!-
730 \fn Qt::Orientation QWheelEvent::orientation() const-
731 \obsolete-
732-
733 Returns the wheel's orientation.-
734-
735 Use angleDelta() instead.-
736*/-
737-
738/*!-
739 \obsolete-
740 Constructs a wheel event object.-
741-
742 Use the constructor taking \e angleDelta and \e pixelDelta QPoints instead.-
743-
744 The position, \a pos, is the location of the mouse cursor within-
745 the widget. The globalPos() is initialized to QCursor::pos()-
746 which is usually, but not always, correct.-
747 Use the other constructor if you need to specify the global-
748 position explicitly.-
749-
750 The \a buttons describe the state of the mouse buttons at the time-
751 of the event, \a delta contains the rotation distance,-
752 \a modifiers holds the keyboard modifier flags at the time of the-
753 event, and \a orient holds the wheel's orientation.-
754-
755 \sa pos(), pixelDelta(), angleDelta()-
756*/-
757#ifndef QT_NO_WHEELEVENT-
758QWheelEvent::QWheelEvent(const QPointF &pos, int delta,-
759 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,-
760 Qt::Orientation orient)-
761 : QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons),-
762 ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false)-
763{-
764 g = QCursor::pos();-
765 if (orient == Qt::Vertical)
orient == Qt::VerticalDescription
TRUEnever evaluated
FALSEnever evaluated
0
766 angleD = QPoint(0, delta);
never executed: angleD = QPoint(0, delta);
0
767 else-
768 angleD = QPoint(delta, 0);
never executed: angleD = QPoint(delta, 0);
0
769}-
770-
771/*!-
772 \internal-
773*/-
774QWheelEvent::~QWheelEvent()-
775{-
776}-
777-
778/*!-
779 \obsolete-
780 Constructs a wheel event object.-
781-
782 Use the constructor taking \e angleDelta and \e pixelDelta QPoints instead.-
783-
784 The \a pos provides the location of the mouse cursor-
785 within the widget. The position in global coordinates is specified-
786 by \a globalPos. \a delta contains the rotation distance, \a modifiers-
787 holds the keyboard modifier flags at the time of the event, and-
788 \a orient holds the wheel's orientation.-
789-
790-
791 \sa pos(), pixelDelta(), angleDelta()-
792*/-
793QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta,-
794 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,-
795 Qt::Orientation orient)-
796 : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons),-
797 ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false)-
798{-
799 if (orient == Qt::Vertical)
orient == Qt::VerticalDescription
TRUEnever evaluated
FALSEnever evaluated
0
800 angleD = QPoint(0, delta);
never executed: angleD = QPoint(0, delta);
0
801 else-
802 angleD = QPoint(delta, 0);
never executed: angleD = QPoint(delta, 0);
0
803}-
804-
805/*!-
806 Constructs a wheel event object.-
807-
808 The \a pos provides the location of the mouse cursor-
809 within the window. The position in global coordinates is specified-
810 by \a globalPos.-
811-
812 \a pixelDelta contains the scrolling distance in pixels on screen, while-
813 \a angleDelta contains the wheel rotation distance. \a pixelDelta is-
814 optional and can be null.-
815-
816 The mouse and keyboard states at the time of the event are specified by-
817 \a buttons and \a modifiers.-
818-
819 For backwards compatibility, the event can also hold monodirectional wheel-
820 event data: \a qt4Delta specifies the rotation, and \a qt4Orientation the-
821 direction.-
822-
823 The phase() is initialized to Qt::ScrollUpdate. Use the other constructor-
824 to specify the phase explicitly.-
825-
826 \sa posF(), globalPosF(), angleDelta(), pixelDelta()-
827*/-
828-
829QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,-
830 QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,-
831 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)-
832 : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),-
833 angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(Qt::NoScrollPhase),-
834 src(Qt::MouseEventNotSynthesized), invertedScrolling(false)-
835{}
never executed: end of block
0
836-
837/*!-
838 Constructs a wheel event object.-
839-
840 The \a pos provides the location of the mouse cursor-
841 within the window. The position in global coordinates is specified-
842 by \a globalPos.-
843-
844 \a pixelDelta contains the scrolling distance in pixels on screen, while-
845 \a angleDelta contains the wheel rotation distance. \a pixelDelta is-
846 optional and can be null.-
847-
848 The mouse and keyboard states at the time of the event are specified by-
849 \a buttons and \a modifiers.-
850-
851 For backwards compatibility, the event can also hold monodirectional wheel-
852 event data: \a qt4Delta specifies the rotation, and \a qt4Orientation the-
853 direction.-
854-
855 The scrolling phase of the event is specified by \a phase.-
856-
857 \sa posF(), globalPosF(), angleDelta(), pixelDelta(), phase()-
858*/-
859-
860QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,-
861 QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,-
862 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase)-
863 : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),-
864 angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase),-
865 src(Qt::MouseEventNotSynthesized), invertedScrolling(false)-
866{}
never executed: end of block
0
867-
868/*!-
869 Constructs a wheel event object.-
870-
871 The \a pos provides the location of the mouse cursor within the window. The-
872 position in global coordinates is specified by \a globalPos.-
873-
874 \a pixelDelta contains the scrolling distance in pixels on screen, while-
875 \a angleDelta contains the wheel rotation distance. \a pixelDelta is-
876 optional and can be null.-
877-
878 The mouse and keyboard states at the time of the event are specified by-
879 \a buttons and \a modifiers.-
880-
881 For backwards compatibility, the event can also hold monodirectional wheel-
882 event data: \a qt4Delta specifies the rotation, and \a qt4Orientation the-
883 direction.-
884-
885 The scrolling phase of the event is specified by \a phase.-
886-
887 If the wheel event comes from a physical mouse wheel, \a source is set to-
888 Qt::MouseEventNotSynthesized. If it comes from a gesture detected by the-
889 operating system, or from a non-mouse hardware device, such that \a pixelDelta is-
890 directly related to finger movement, \a source is set to Qt::MouseEventSynthesizedBySystem.-
891 If it comes from Qt, source would be set to Qt::MouseEventSynthesizedByQt.-
892-
893 \sa posF(), globalPosF(), angleDelta(), pixelDelta(), phase()-
894*/-
895-
896QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,-
897 QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,-
898 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source)-
899 : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),-
900 angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), src(source),-
901 invertedScrolling(false)-
902{}
never executed: end of block
0
903-
904/*!-
905 Constructs a wheel event object.-
906-
907 The \a pos provides the location of the mouse cursor-
908 within the window. The position in global coordinates is specified-
909 by \a globalPos.-
910-
911 \a pixelDelta contains the scrolling distance in pixels on screen, while-
912 \a angleDelta contains the wheel rotation distance. \a pixelDelta is-
913 optional and can be null.-
914-
915 The mouse and keyboard states at the time of the event are specified by-
916 \a buttons and \a modifiers.-
917-
918 For backwards compatibility, the event can also hold monodirectional wheel-
919 event data: \a qt4Delta specifies the rotation, and \a qt4Orientation the-
920 direction.-
921-
922 The scrolling phase of the event is specified by \a phase.-
923-
924 If the wheel event comes from a physical mouse wheel, \a source is set to-
925 Qt::MouseEventNotSynthesized. If it comes from a gesture detected by the-
926 operating system, or from a non-mouse hardware device, such that \a-
927 pixelDelta is directly related to finger movement, \a source is set to-
928 Qt::MouseEventSynthesizedBySystem. If it comes from Qt, source would be set-
929 to Qt::MouseEventSynthesizedByQt.-
930-
931 If the system is configured to invert the delta values delivered with the-
932 event (such as natural scrolling of the touchpad on OS X), \a inverted-
933 should be \c true. Otherwise, \a inverted is \c false-
934-
935 \sa posF(), globalPosF(), angleDelta(), pixelDelta(), phase()-
936*/-
937QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,-
938 QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,-
939 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source, bool inverted)-
940 : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),-
941 angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), src(source),-
942 invertedScrolling(inverted)-
943{}
never executed: end of block
0
944-
945#endif // QT_NO_WHEELEVENT-
946-
947/*!-
948 \fn QPoint QWheelEvent::pixelDelta() const-
949-
950 Returns the scrolling distance in pixels on screen. This value is-
951 provided on platforms that support high-resolution pixel-based-
952 delta values, such as \macos. The value should be used directly-
953 to scroll content on screen.-
954-
955 Example:-
956-
957 \snippet code/src_gui_kernel_qevent.cpp 0-
958-
959 \note On platforms that support scrolling \l{phase()}{phases}, the delta may be null when:-
960 \list-
961 \li scrolling is about to begin, but the distance did not yet change (Qt::ScrollBegin),-
962 \li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd).-
963 \endlist-
964*/-
965-
966/*!-
967 \fn QPoint QWheelEvent::angleDelta() const-
968-
969 Returns the distance that the wheel is rotated, in eighths of a-
970 degree. A positive value indicates that the wheel was rotated-
971 forwards away from the user; a negative value indicates that the-
972 wheel was rotated backwards toward the user.-
973-
974 Most mouse types work in steps of 15 degrees, in which case the-
975 delta value is a multiple of 120; i.e., 120 units * 1/8 = 15 degrees.-
976-
977 However, some mice have finer-resolution wheels and send delta values-
978 that are less than 120 units (less than 15 degrees). To support this-
979 possibility, you can either cumulatively add the delta values from events-
980 until the value of 120 is reached, then scroll the widget, or you can-
981 partially scroll the widget in response to each wheel event.-
982-
983 Example:-
984-
985 \snippet code/src_gui_kernel_qevent.cpp 0-
986-
987 \note On platforms that support scrolling \l{phase()}{phases}, the delta may be null when:-
988 \list-
989 \li scrolling is about to begin, but the distance did not yet change (Qt::ScrollBegin),-
990 \li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd).-
991 \endlist-
992*/-
993-
994/*!-
995 \fn int QWheelEvent::delta() const-
996 \obsolete-
997-
998 This function has been deprecated, use pixelDelta() or angleDelta() instead.-
999*/-
1000-
1001/*!-
1002 \fn QPoint QWheelEvent::pos() const-
1003-
1004 Returns the position of the mouse cursor relative to the widget-
1005 that received the event.-
1006-
1007 If you move your widgets around in response to mouse events,-
1008 use globalPos() instead of this function.-
1009-
1010 \sa x(), y(), globalPos()-
1011*/-
1012-
1013/*!-
1014 \fn int QWheelEvent::x() const-
1015-
1016 Returns the x position of the mouse cursor, relative to the-
1017 widget that received the event.-
1018-
1019 \sa y(), pos()-
1020*/-
1021-
1022/*!-
1023 \fn int QWheelEvent::y() const-
1024-
1025 Returns the y position of the mouse cursor, relative to the-
1026 widget that received the event.-
1027-
1028 \sa x(), pos()-
1029*/-
1030-
1031-
1032/*!-
1033 \fn QPoint QWheelEvent::globalPos() const-
1034-
1035 Returns the global position of the mouse pointer \e{at the time-
1036 of the event}. This is important on asynchronous window systems-
1037 such as X11; whenever you move your widgets around in response to-
1038 mouse events, globalPos() can differ a lot from the current-
1039 cursor position returned by QCursor::pos().-
1040-
1041 \sa globalX(), globalY()-
1042*/-
1043-
1044/*!-
1045 \fn int QWheelEvent::globalX() const-
1046-
1047 Returns the global x position of the mouse cursor at the time of-
1048 the event.-
1049-
1050 \sa globalY(), globalPos()-
1051*/-
1052-
1053/*!-
1054 \fn int QWheelEvent::globalY() const-
1055-
1056 Returns the global y position of the mouse cursor at the time of-
1057 the event.-
1058-
1059 \sa globalX(), globalPos()-
1060*/-
1061-
1062/*!-
1063 \fn const QPointF &QWheelEvent::posF() const-
1064-
1065 Returns the position of the mouse cursor relative to the widget-
1066 that received the event.-
1067-
1068 If you move your widgets around in response to mouse events,-
1069 use globalPosF() instead of this function.-
1070-
1071 \sa globalPosF()-
1072*/-
1073-
1074/*!-
1075 \fn const QPointF &QWheelEvent::globalPosF() const-
1076-
1077 Returns the global position of the mouse pointer \e{at the time-
1078 of the event}. This is important on asynchronous window systems-
1079 such as X11; whenever you move your widgets around in response to-
1080 mouse events, globalPosF() can differ a lot from the current-
1081 cursor position returned by QCursor::pos().-
1082-
1083 \sa posF()-
1084*/-
1085-
1086/*!-
1087 \fn Qt::ScrollPhase QWheelEvent::phase() const-
1088 \since 5.2-
1089-
1090 Returns the scrolling phase of this wheel event.-
1091-
1092 \note The Qt::ScrollBegin and Qt::ScrollEnd phases are currently-
1093 supported only on \macos.-
1094*/-
1095-
1096-
1097/*!-
1098 \class QKeyEvent-
1099 \brief The QKeyEvent class describes a key event.-
1100-
1101 \ingroup events-
1102 \inmodule QtGui-
1103-
1104 Key events are sent to the widget with keyboard input focus-
1105 when keys are pressed or released.-
1106-
1107 A key event contains a special accept flag that indicates whether-
1108 the receiver will handle the key event. This flag is set by default-
1109 for QEvent::KeyPress and QEvent::KeyRelease, so there is no need to-
1110 call accept() when acting on a key event. For QEvent::ShortcutOverride-
1111 the receiver needs to explicitly accept the event to trigger the override.-
1112 Calling ignore() on a key event will propagate it to the parent widget.-
1113 The event is propagated up the parent widget chain until a widget-
1114 accepts it or an event filter consumes it.-
1115-
1116 The QWidget::setEnable() function can be used to enable or disable-
1117 mouse and keyboard events for a widget.-
1118-
1119 The event handlers QWidget::keyPressEvent(), QWidget::keyReleaseEvent(),-
1120 QGraphicsItem::keyPressEvent() and QGraphicsItem::keyReleaseEvent()-
1121 receive key events.-
1122-
1123 \sa QFocusEvent, QWidget::grabKeyboard()-
1124*/-
1125-
1126/*!-
1127 Constructs a key event object.-
1128-
1129 The \a type parameter must be QEvent::KeyPress, QEvent::KeyRelease,-
1130 or QEvent::ShortcutOverride.-
1131-
1132 Int \a key is the code for the Qt::Key that the event loop should listen-
1133 for. If \a key is 0, the event is not a result of a known key; for-
1134 example, it may be the result of a compose sequence or keyboard macro.-
1135 The \a modifiers holds the keyboard modifiers, and the given \a text-
1136 is the Unicode text that the key generated. If \a autorep is true,-
1137 isAutoRepeat() will be true. \a count is the number of keys involved-
1138 in the event.-
1139*/-
1140QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text,-
1141 bool autorep, ushort count)-
1142 : QInputEvent(type, modifiers), txt(text), k(key),-
1143 nScanCode(0), nVirtualKey(0), nModifiers(0),-
1144 c(count), autor(autorep)-
1145{-
1146 if (type == QEvent::ShortcutOverride)
type == QEvent...ortcutOverrideDescription
TRUEnever evaluated
FALSEnever evaluated
0
1147 ignore();
never executed: ignore();
0
1148}
never executed: end of block
0
1149-
1150/*!-
1151 Constructs a key event object.-
1152-
1153 The \a type parameter must be QEvent::KeyPress, QEvent::KeyRelease,-
1154 or QEvent::ShortcutOverride.-
1155-
1156 Int \a key is the code for the Qt::Key that the event loop should listen-
1157 for. If \a key is 0, the event is not a result of a known key; for-
1158 example, it may be the result of a compose sequence or keyboard macro.-
1159 The \a modifiers holds the keyboard modifiers, and the given \a text-
1160 is the Unicode text that the key generated. If \a autorep is true,-
1161 isAutoRepeat() will be true. \a count is the number of keys involved-
1162 in the event.-
1163-
1164 In addition to the normal key event data, also contains \a nativeScanCode,-
1165 \a nativeVirtualKey and \a nativeModifiers. This extra data is used by the-
1166 shortcut system, to determine which shortcuts to trigger.-
1167*/-
1168QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,-
1169 quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,-
1170 const QString &text, bool autorep, ushort count)-
1171 : QInputEvent(type, modifiers), txt(text), k(key),-
1172 nScanCode(nativeScanCode), nVirtualKey(nativeVirtualKey), nModifiers(nativeModifiers),-
1173 c(count), autor(autorep)-
1174{-
1175 if (type == QEvent::ShortcutOverride)
type == QEvent...ortcutOverrideDescription
TRUEnever evaluated
FALSEnever evaluated
0
1176 ignore();
never executed: ignore();
0
1177}
never executed: end of block
0
1178-
1179-
1180/*!-
1181 \internal-
1182*/-
1183QKeyEvent::~QKeyEvent()-
1184{-
1185}-
1186-
1187/*!-
1188 \fn QKeyEvent *QKeyEvent::createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString& text, bool autorep, ushort count)-
1189 \internal-
1190*/-
1191-
1192/*!-
1193 \fn bool QKeyEvent::hasExtendedInfo() const-
1194 \internal-
1195*/-
1196-
1197/*!-
1198 \fn quint32 QKeyEvent::nativeScanCode() const-
1199 \since 4.2-
1200-
1201 Returns the native scan code of the key event. If the key event-
1202 does not contain this data 0 is returned.-
1203-
1204 Note: The native scan code may be 0, even if the key event contains-
1205 extended information.-
1206-
1207 Note: On Mac OS/X, this function is not useful, because there is no-
1208 way to get the scan code from Carbon or Cocoa. The function always-
1209 returns 1 (or 0 in the case explained above).-
1210*/-
1211-
1212/*!-
1213 \fn quint32 QKeyEvent::nativeVirtualKey() const-
1214 \since 4.2-
1215-
1216 Returns the native virtual key, or key sym of the key event.-
1217 If the key event does not contain this data 0 is returned.-
1218-
1219 Note: The native virtual key may be 0, even if the key event contains extended information.-
1220*/-
1221-
1222/*!-
1223 \fn quint32 QKeyEvent::nativeModifiers() const-
1224 \since 4.2-
1225-
1226 Returns the native modifiers of a key event.-
1227 If the key event does not contain this data 0 is returned.-
1228-
1229 Note: The native modifiers may be 0, even if the key event contains extended information.-
1230*/-
1231-
1232/*!-
1233 \fn int QKeyEvent::key() const-
1234-
1235 Returns the code of the key that was pressed or released.-
1236-
1237 See \l Qt::Key for the list of keyboard codes. These codes are-
1238 independent of the underlying window system. Note that this-
1239 function does not distinguish between capital and non-capital-
1240 letters, use the text() function (returning the Unicode text the-
1241 key generated) for this purpose.-
1242-
1243 A value of either 0 or Qt::Key_unknown means that the event is not-
1244 the result of a known key; for example, it may be the result of-
1245 a compose sequence, a keyboard macro, or due to key event-
1246 compression.-
1247-
1248 \sa Qt::WA_KeyCompression-
1249*/-
1250-
1251/*!-
1252 \fn QString QKeyEvent::text() const-
1253-
1254 Returns the Unicode text that this key generated.-
1255-
1256 Return values when modifier keys such as-
1257 Shift, Control, Alt, and Meta are pressed-
1258 differ among platforms and could return an empty string.-
1259-
1260 \note \l key() will always return a valid value,-
1261 independent of modifier keys.-
1262-
1263 \sa Qt::WA_KeyCompression-
1264*/-
1265-
1266/*!-
1267 Returns the keyboard modifier flags that existed immediately-
1268 after the event occurred.-
1269-
1270 \warning This function cannot always be trusted. The user can-
1271 confuse it by pressing both \uicontrol{Shift} keys simultaneously and-
1272 releasing one of them, for example.-
1273-
1274 \sa QGuiApplication::keyboardModifiers()-
1275*/-
1276-
1277Qt::KeyboardModifiers QKeyEvent::modifiers() const-
1278{-
1279 if (key() == Qt::Key_Shift)
key() == Qt::Key_ShiftDescription
TRUEnever evaluated
FALSEnever evaluated
0
1280 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ShiftModifier);
never executed: return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ShiftModifier);
0
1281 if (key() == Qt::Key_Control)
key() == Qt::Key_ControlDescription
TRUEnever evaluated
FALSEnever evaluated
0
1282 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ControlModifier);
never executed: return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ControlModifier);
0
1283 if (key() == Qt::Key_Alt)
key() == Qt::Key_AltDescription
TRUEnever evaluated
FALSEnever evaluated
0
1284 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::AltModifier);
never executed: return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::AltModifier);
0
1285 if (key() == Qt::Key_Meta)
key() == Qt::Key_MetaDescription
TRUEnever evaluated
FALSEnever evaluated
0
1286 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::MetaModifier);
never executed: return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::MetaModifier);
0
1287 if (key() == Qt::Key_AltGr)
key() == Qt::Key_AltGrDescription
TRUEnever evaluated
FALSEnever evaluated
0
1288 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::GroupSwitchModifier);
never executed: return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::GroupSwitchModifier);
0
1289 return QInputEvent::modifiers();
never executed: return QInputEvent::modifiers();
0
1290}-
1291-
1292#ifndef QT_NO_SHORTCUT-
1293/*!-
1294 \fn bool QKeyEvent::matches(QKeySequence::StandardKey key) const-
1295 \since 4.2-
1296-
1297 Returns \c true if the key event matches the given standard \a key;-
1298 otherwise returns \c false.-
1299*/-
1300bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const-
1301{-
1302 //The keypad and group switch modifier should not make a difference-
1303 uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier | Qt::GroupSwitchModifier);-
1304-
1305 const QList<QKeySequence> bindings = QKeySequence::keyBindings(matchKey);-
1306 return bindings.contains(QKeySequence(searchkey));
never executed: return bindings.contains(QKeySequence(searchkey));
0
1307}-
1308#endif // QT_NO_SHORTCUT-
1309-
1310-
1311/*!-
1312 \fn bool QKeyEvent::isAutoRepeat() const-
1313-
1314 Returns \c true if this event comes from an auto-repeating key;-
1315 returns \c false if it comes from an initial key press.-
1316-
1317 Note that if the event is a multiple-key compressed event that is-
1318 partly due to auto-repeat, this function could return either true-
1319 or false indeterminately.-
1320*/-
1321-
1322/*!-
1323 \fn int QKeyEvent::count() const-
1324-
1325 Returns the number of keys involved in this event. If text()-
1326 is not empty, this is simply the length of the string.-
1327-
1328 \sa Qt::WA_KeyCompression-
1329*/-
1330-
1331/*!-
1332 \class QFocusEvent-
1333 \brief The QFocusEvent class contains event parameters for widget focus-
1334 events.-
1335 \inmodule QtGui-
1336-
1337 \ingroup events-
1338-
1339 Focus events are sent to widgets when the keyboard input focus-
1340 changes. Focus events occur due to mouse actions, key presses-
1341 (such as \uicontrol{Tab} or \uicontrol{Backtab}), the window system, popup-
1342 menus, keyboard shortcuts, or other application-specific reasons.-
1343 The reason for a particular focus event is returned by reason()-
1344 in the appropriate event handler.-
1345-
1346 The event handlers QWidget::focusInEvent(),-
1347 QWidget::focusOutEvent(), QGraphicsItem::focusInEvent and-
1348 QGraphicsItem::focusOutEvent() receive focus events.-
1349-
1350 \sa QWidget::setFocus(), QWidget::setFocusPolicy(), {Keyboard Focus in Widgets}-
1351*/-
1352-
1353/*!-
1354 Constructs a focus event object.-
1355-
1356 The \a type parameter must be either QEvent::FocusIn or-
1357 QEvent::FocusOut. The \a reason describes the cause of the change-
1358 in focus.-
1359*/-
1360QFocusEvent::QFocusEvent(Type type, Qt::FocusReason reason)-
1361 : QEvent(type), m_reason(reason)-
1362{}
never executed: end of block
0
1363-
1364/*!-
1365 \internal-
1366*/-
1367QFocusEvent::~QFocusEvent()-
1368{-
1369}-
1370-
1371/*!-
1372 Returns the reason for this focus event.-
1373 */-
1374Qt::FocusReason QFocusEvent::reason() const-
1375{-
1376 return m_reason;
never executed: return m_reason;
0
1377}-
1378-
1379/*!-
1380 \fn bool QFocusEvent::gotFocus() const-
1381-
1382 Returns \c true if type() is QEvent::FocusIn; otherwise returns-
1383 false.-
1384*/-
1385-
1386/*!-
1387 \fn bool QFocusEvent::lostFocus() const-
1388-
1389 Returns \c true if type() is QEvent::FocusOut; otherwise returns-
1390 false.-
1391*/-
1392-
1393-
1394/*!-
1395 \class QPaintEvent-
1396 \brief The QPaintEvent class contains event parameters for paint events.-
1397 \inmodule QtGui-
1398-
1399 \ingroup events-
1400-
1401 Paint events are sent to widgets that need to update themselves,-
1402 for instance when part of a widget is exposed because a covering-
1403 widget was moved.-
1404-
1405 The event contains a region() that needs to be updated, and a-
1406 rect() that is the bounding rectangle of that region. Both are-
1407 provided because many widgets cannot make much use of region(),-
1408 and rect() can be much faster than region().boundingRect().-
1409-
1410 \section1 Automatic Clipping-
1411-
1412 Painting is clipped to region() during the processing of a paint-
1413 event. This clipping is performed by Qt's paint system and is-
1414 independent of any clipping that may be applied to a QPainter used to-
1415 draw on the paint device.-
1416-
1417 As a result, the value returned by QPainter::clipRegion() on-
1418 a newly-constructed QPainter will not reflect the clip region that is-
1419 used by the paint system.-
1420-
1421 \sa QPainter, QWidget::update(), QWidget::repaint(),-
1422 QWidget::paintEvent()-
1423*/-
1424-
1425/*!-
1426 Constructs a paint event object with the region that needs to-
1427 be updated. The region is specified by \a paintRegion.-
1428*/-
1429QPaintEvent::QPaintEvent(const QRegion& paintRegion)-
1430 : QEvent(Paint), m_rect(paintRegion.boundingRect()), m_region(paintRegion), m_erased(false)-
1431{}
never executed: end of block
0
1432-
1433/*!-
1434 Constructs a paint event object with the rectangle that needs-
1435 to be updated. The region is specified by \a paintRect.-
1436*/-
1437QPaintEvent::QPaintEvent(const QRect &paintRect)-
1438 : QEvent(Paint), m_rect(paintRect),m_region(paintRect), m_erased(false)-
1439{}
never executed: end of block
0
1440-
1441-
1442/*!-
1443 \internal-
1444*/-
1445QPaintEvent::~QPaintEvent()-
1446{-
1447}-
1448-
1449/*!-
1450 \fn const QRect &QPaintEvent::rect() const-
1451-
1452 Returns the rectangle that needs to be updated.-
1453-
1454 \sa region(), QPainter::setClipRect()-
1455*/-
1456-
1457/*!-
1458 \fn const QRegion &QPaintEvent::region() const-
1459-
1460 Returns the region that needs to be updated.-
1461-
1462 \sa rect(), QPainter::setClipRegion()-
1463*/-
1464-
1465-
1466/*!-
1467 \class QMoveEvent-
1468 \brief The QMoveEvent class contains event parameters for move events.-
1469 \inmodule QtGui-
1470-
1471 \ingroup events-
1472-
1473 Move events are sent to widgets that have been moved to a new-
1474 position relative to their parent.-
1475-
1476 The event handler QWidget::moveEvent() receives move events.-
1477-
1478 \sa QWidget::move(), QWidget::setGeometry()-
1479*/-
1480-
1481/*!-
1482 Constructs a move event with the new and old widget positions,-
1483 \a pos and \a oldPos respectively.-
1484*/-
1485QMoveEvent::QMoveEvent(const QPoint &pos, const QPoint &oldPos)-
1486 : QEvent(Move), p(pos), oldp(oldPos)-
1487{}
never executed: end of block
0
1488-
1489/*!-
1490 \internal-
1491*/-
1492QMoveEvent::~QMoveEvent()-
1493{-
1494}-
1495-
1496/*!-
1497 \fn const QPoint &QMoveEvent::pos() const-
1498-
1499 Returns the new position of the widget. This excludes the window-
1500 frame for top level widgets.-
1501*/-
1502-
1503/*!-
1504 \fn const QPoint &QMoveEvent::oldPos() const-
1505-
1506 Returns the old position of the widget.-
1507*/-
1508-
1509/*!-
1510 \class QExposeEvent-
1511 \since 5.0-
1512 \brief The QExposeEvent class contains event parameters for expose events.-
1513 \inmodule QtGui-
1514-
1515 \ingroup events-
1516-
1517 Expose events are sent to windows when an area of the window is invalidated-
1518 or window visibility in the windowing system changes.-
1519-
1520 The event handler QWindow::exposeEvent() receives expose events.-
1521*/-
1522-
1523/*!-
1524 Constructs an expose event for the given \a exposeRegion which must be-
1525 in local coordinates.-
1526*/-
1527QExposeEvent::QExposeEvent(const QRegion &exposeRegion)-
1528 : QEvent(Expose)-
1529 , rgn(exposeRegion)-
1530{-
1531}
never executed: end of block
0
1532-
1533/*!-
1534 \internal-
1535*/-
1536QExposeEvent::~QExposeEvent()-
1537{-
1538}-
1539-
1540/*!-
1541 \class QPlatformSurfaceEvent-
1542 \since 5.5-
1543 \brief The QPlatformSurfaceEvent class is used to notify about native platform surface events.-
1544 \inmodule QtGui-
1545-
1546 \ingroup events-
1547-
1548 Platform window events are synchronously sent to windows and offscreen surfaces when their-
1549 underlying native surfaces are created or are about to be destroyed.-
1550-
1551 Applications can respond to these events to know when the underlying platform-
1552 surface exists.-
1553*/-
1554-
1555/*!-
1556 \enum QPlatformSurfaceEvent::SurfaceEventType-
1557-
1558 This enum describes the type of platform surface event. The possible types are:-
1559-
1560 \value SurfaceCreated The underlying native surface has been created-
1561 \value SurfaceAboutToBeDestroyed The underlying native surface will be destroyed immediately after this event-
1562-
1563 The \c SurfaceAboutToBeDestroyed event type is useful as a means of stopping rendering to-
1564 a platform window before it is destroyed.-
1565*/-
1566-
1567/*!-
1568 \fn QPlatformSurfaceEvent::SurfaceEventType QPlatformSurfaceEvent::surfaceEventType() const-
1569-
1570 Returns the specific type of platform surface event.-
1571*/-
1572-
1573/*!-
1574 Constructs a platform surface event for the given \a surfaceEventType.-
1575*/-
1576QPlatformSurfaceEvent::QPlatformSurfaceEvent(SurfaceEventType surfaceEventType)-
1577 : QEvent(PlatformSurface)-
1578 , m_surfaceEventType(surfaceEventType)-
1579{-
1580}
never executed: end of block
0
1581-
1582/*!-
1583 \internal-
1584*/-
1585QPlatformSurfaceEvent::~QPlatformSurfaceEvent()-
1586{-
1587}-
1588-
1589/*!-
1590 \fn const QRegion &QExposeEvent::region() const-
1591-
1592 Returns the window area that has been exposed. The region is given in local coordinates.-
1593*/-
1594-
1595/*!-
1596 \class QResizeEvent-
1597 \brief The QResizeEvent class contains event parameters for resize events.-
1598 \inmodule QtGui-
1599-
1600 \ingroup events-
1601-
1602 Resize events are sent to widgets that have been resized.-
1603-
1604 The event handler QWidget::resizeEvent() receives resize events.-
1605-
1606 \sa QWidget::resize(), QWidget::setGeometry()-
1607*/-
1608-
1609/*!-
1610 Constructs a resize event with the new and old widget sizes, \a-
1611 size and \a oldSize respectively.-
1612*/-
1613QResizeEvent::QResizeEvent(const QSize &size, const QSize &oldSize)-
1614 : QEvent(Resize), s(size), olds(oldSize)-
1615{}
never executed: end of block
0
1616-
1617/*!-
1618 \internal-
1619*/-
1620QResizeEvent::~QResizeEvent()-
1621{-
1622}-
1623-
1624/*!-
1625 \fn const QSize &QResizeEvent::size() const-
1626-
1627 Returns the new size of the widget. This is the same as-
1628 QWidget::size().-
1629*/-
1630-
1631/*!-
1632 \fn const QSize &QResizeEvent::oldSize() const-
1633-
1634 Returns the old size of the widget.-
1635*/-
1636-
1637-
1638/*!-
1639 \class QCloseEvent-
1640 \brief The QCloseEvent class contains parameters that describe a close event.-
1641-
1642 \ingroup events-
1643 \inmodule QtGui-
1644-
1645 Close events are sent to widgets that the user wants to close,-
1646 usually by choosing "Close" from the window menu, or by clicking-
1647 the \uicontrol{X} title bar button. They are also sent when you call-
1648 QWidget::close() to close a widget programmatically.-
1649-
1650 Close events contain a flag that indicates whether the receiver-
1651 wants the widget to be closed or not. When a widget accepts the-
1652 close event, it is hidden (and destroyed if it was created with-
1653 the Qt::WA_DeleteOnClose flag). If it refuses to accept the close-
1654 event nothing happens. (Under X11 it is possible that the window-
1655 manager will forcibly close the window; but at the time of writing-
1656 we are not aware of any window manager that does this.)-
1657-
1658 The event handler QWidget::closeEvent() receives close events. The-
1659 default implementation of this event handler accepts the close-
1660 event. If you do not want your widget to be hidden, or want some-
1661 special handling, you should reimplement the event handler and-
1662 ignore() the event.-
1663-
1664 The \l{mainwindows/application#close event handler}{closeEvent() in the-
1665 Application example} shows a close event handler that-
1666 asks whether to save a document before closing.-
1667-
1668 If you want the widget to be deleted when it is closed, create it-
1669 with the Qt::WA_DeleteOnClose flag. This is very useful for-
1670 independent top-level windows in a multi-window application.-
1671-
1672 \l{QObject}s emits the \l{QObject::destroyed()}{destroyed()}-
1673 signal when they are deleted.-
1674-
1675 If the last top-level window is closed, the-
1676 QGuiApplication::lastWindowClosed() signal is emitted.-
1677-
1678 The isAccepted() function returns \c true if the event's receiver has-
1679 agreed to close the widget; call accept() to agree to close the-
1680 widget and call ignore() if the receiver of this event does not-
1681 want the widget to be closed.-
1682-
1683 \sa QWidget::close(), QWidget::hide(), QObject::destroyed(),-
1684 QCoreApplication::exec(), QCoreApplication::quit(),-
1685 QGuiApplication::lastWindowClosed()-
1686*/-
1687-
1688/*!-
1689 Constructs a close event object.-
1690-
1691 \sa accept()-
1692*/-
1693QCloseEvent::QCloseEvent()-
1694 : QEvent(Close)-
1695{}
never executed: end of block
0
1696-
1697/*! \internal-
1698*/-
1699QCloseEvent::~QCloseEvent()-
1700{-
1701}-
1702-
1703/*!-
1704 \class QIconDragEvent-
1705 \brief The QIconDragEvent class indicates that a main icon drag has begun.-
1706 \inmodule QtGui-
1707-
1708 \ingroup events-
1709-
1710 Icon drag events are sent to widgets when the main icon of a window-
1711 has been dragged away. On \macos, this happens when the proxy-
1712 icon of a window is dragged off the title bar.-
1713-
1714 It is normal to begin using drag and drop in response to this-
1715 event.-
1716-
1717 \sa {Drag and Drop}, QMimeData, QDrag-
1718*/-
1719-
1720/*!-
1721 Constructs an icon drag event object with the accept flag set to-
1722 false.-
1723-
1724 \sa accept()-
1725*/-
1726QIconDragEvent::QIconDragEvent()-
1727 : QEvent(IconDrag)-
1728{
never executed: end of block
ignore(); }
never executed: end of block
0
1729-
1730/*! \internal */-
1731QIconDragEvent::~QIconDragEvent()-
1732{-
1733}-
1734-
1735/*!-
1736 \class QContextMenuEvent-
1737 \brief The QContextMenuEvent class contains parameters that describe a context menu event.-
1738 \inmodule QtGui-
1739-
1740 \ingroup events-
1741-
1742 Context menu events are sent to widgets when a user performs-
1743 an action associated with opening a context menu.-
1744 The actions required to open context menus vary between platforms;-
1745 for example, on Windows, pressing the menu button or clicking the-
1746 right mouse button will cause this event to be sent.-
1747-
1748 When this event occurs it is customary to show a QMenu with a-
1749 context menu, if this is relevant to the context.-
1750-
1751 Context menu events contain a special accept flag that indicates-
1752 whether the receiver accepted the event. If the event handler does-
1753 not accept the event then, if possible, whatever triggered the event will be-
1754 handled as a regular input event.-
1755*/-
1756-
1757#ifndef QT_NO_CONTEXTMENU-
1758/*!-
1759 Constructs a context menu event object with the accept parameter-
1760 flag set to false.-
1761-
1762 The \a reason parameter must be QContextMenuEvent::Mouse or-
1763 QContextMenuEvent::Keyboard.-
1764-
1765 The \a pos parameter specifies the mouse position relative to the-
1766 receiving widget. \a globalPos is the mouse position in absolute-
1767 coordinates.-
1768*/-
1769QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos)-
1770 : QInputEvent(ContextMenu), p(pos), gp(globalPos), reas(reason)-
1771{}
never executed: end of block
0
1772-
1773/*!-
1774 Constructs a context menu event object with the accept parameter-
1775 flag set to false.-
1776-
1777 The \a reason parameter must be QContextMenuEvent::Mouse or-
1778 QContextMenuEvent::Keyboard.-
1779-
1780 The \a pos parameter specifies the mouse position relative to the-
1781 receiving widget. \a globalPos is the mouse position in absolute-
1782 coordinates. The \a modifiers holds the keyboard modifiers.-
1783*/-
1784QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos,-
1785 Qt::KeyboardModifiers modifiers)-
1786 : QInputEvent(ContextMenu, modifiers), p(pos), gp(globalPos), reas(reason)-
1787{}
never executed: end of block
0
1788-
1789-
1790/*! \internal */-
1791QContextMenuEvent::~QContextMenuEvent()-
1792{-
1793}-
1794/*!-
1795 Constructs a context menu event object with the accept parameter-
1796 flag set to false.-
1797-
1798 The \a reason parameter must be QContextMenuEvent::Mouse or-
1799 QContextMenuEvent::Keyboard.-
1800-
1801 The \a pos parameter specifies the mouse position relative to the-
1802 receiving widget.-
1803-
1804 The globalPos() is initialized to QCursor::pos(), which may not be-
1805 appropriate. Use the other constructor to specify the global-
1806 position explicitly.-
1807*/-
1808QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos)-
1809 : QInputEvent(ContextMenu), p(pos), reas(reason)-
1810{-
1811#ifndef QT_NO_CURSOR-
1812 gp = QCursor::pos();-
1813#endif-
1814}
never executed: end of block
0
1815-
1816/*!-
1817 \fn const QPoint &QContextMenuEvent::pos() const-
1818-
1819 Returns the position of the mouse pointer relative to the widget-
1820 that received the event.-
1821-
1822 \sa x(), y(), globalPos()-
1823*/-
1824-
1825/*!-
1826 \fn int QContextMenuEvent::x() const-
1827-
1828 Returns the x position of the mouse pointer, relative to the-
1829 widget that received the event.-
1830-
1831 \sa y(), pos()-
1832*/-
1833-
1834/*!-
1835 \fn int QContextMenuEvent::y() const-
1836-
1837 Returns the y position of the mouse pointer, relative to the-
1838 widget that received the event.-
1839-
1840 \sa x(), pos()-
1841*/-
1842-
1843/*!-
1844 \fn const QPoint &QContextMenuEvent::globalPos() const-
1845-
1846 Returns the global position of the mouse pointer at the time of-
1847 the event.-
1848-
1849 \sa x(), y(), pos()-
1850*/-
1851-
1852/*!-
1853 \fn int QContextMenuEvent::globalX() const-
1854-
1855 Returns the global x position of the mouse pointer at the time of-
1856 the event.-
1857-
1858 \sa globalY(), globalPos()-
1859*/-
1860-
1861/*!-
1862 \fn int QContextMenuEvent::globalY() const-
1863-
1864 Returns the global y position of the mouse pointer at the time of-
1865 the event.-
1866-
1867 \sa globalX(), globalPos()-
1868*/-
1869#endif // QT_NO_CONTEXTMENU-
1870-
1871/*!-
1872 \enum QContextMenuEvent::Reason-
1873-
1874 This enum describes the reason why the event was sent.-
1875-
1876 \value Mouse The mouse caused the event to be sent. Normally this-
1877 means the right mouse button was clicked, but this is platform-
1878 dependent.-
1879-
1880 \value Keyboard The keyboard caused this event to be sent. On-
1881 Windows, this means the menu button was pressed.-
1882-
1883 \value Other The event was sent by some other means (i.e. not by-
1884 the mouse or keyboard).-
1885*/-
1886-
1887-
1888/*!-
1889 \fn QContextMenuEvent::Reason QContextMenuEvent::reason() const-
1890-
1891 Returns the reason for this context event.-
1892*/-
1893-
1894-
1895/*!-
1896 \class QInputMethodEvent-
1897 \brief The QInputMethodEvent class provides parameters for input method events.-
1898 \inmodule QtGui-
1899-
1900 \ingroup events-
1901-
1902 Input method events are sent to widgets when an input method is-
1903 used to enter text into a widget. Input methods are widely used-
1904 to enter text for languages with non-Latin alphabets.-
1905-
1906 Note that when creating custom text editing widgets, the-
1907 Qt::WA_InputMethodEnabled window attribute must be set explicitly-
1908 (using the QWidget::setAttribute() function) in order to receive-
1909 input method events.-
1910-
1911 The events are of interest to authors of keyboard entry widgets-
1912 who want to be able to correctly handle languages with complex-
1913 character input. Text input in such languages is usually a three-
1914 step process:-
1915-
1916 \list 1-
1917 \li \b{Starting to Compose}-
1918-
1919 When the user presses the first key on a keyboard, an input-
1920 context is created. This input context will contain a string-
1921 of the typed characters.-
1922-
1923 \li \b{Composing}-
1924-
1925 With every new key pressed, the input method will try to create a-
1926 matching string for the text typed so far called preedit-
1927 string. While the input context is active, the user can only move-
1928 the cursor inside the string belonging to this input context.-
1929-
1930 \li \b{Completing}-
1931-
1932 At some point, the user will activate a user interface component-
1933 (perhaps using a particular key) where they can choose from a-
1934 number of strings matching the text they have typed so far. The-
1935 user can either confirm their choice cancel the input; in either-
1936 case the input context will be closed.-
1937 \endlist-
1938-
1939 QInputMethodEvent models these three stages, and transfers the-
1940 information needed to correctly render the intermediate result. A-
1941 QInputMethodEvent has two main parameters: preeditString() and-
1942 commitString(). The preeditString() parameter gives the currently-
1943 active preedit string. The commitString() parameter gives a text-
1944 that should get added to (or replace parts of) the text of the-
1945 editor widget. It usually is a result of the input operations and-
1946 has to be inserted to the widgets text directly before the preedit-
1947 string.-
1948-
1949 If the commitString() should replace parts of the of the text in-
1950 the editor, replacementLength() will contain the number of-
1951 characters to be replaced. replacementStart() contains the position-
1952 at which characters are to be replaced relative from the start of-
1953 the preedit string.-
1954-
1955 A number of attributes control the visual appearance of the-
1956 preedit string (the visual appearance of text outside the preedit-
1957 string is controlled by the widget only). The AttributeType enum-
1958 describes the different attributes that can be set.-
1959-
1960 A class implementing QWidget::inputMethodEvent() or-
1961 QGraphicsItem::inputMethodEvent() should at least understand and-
1962 honor the \l TextFormat and \l Cursor attributes.-
1963-
1964 Since input methods need to be able to query certain properties-
1965 from the widget or graphics item, subclasses must also implement-
1966 QWidget::inputMethodQuery() and QGraphicsItem::inputMethodQuery(),-
1967 respectively.-
1968-
1969 When receiving an input method event, the text widget has to performs the-
1970 following steps:-
1971-
1972 \list 1-
1973 \li If the widget has selected text, the selected text should get-
1974 removed.-
1975-
1976 \li Remove the text starting at replacementStart() with length-
1977 replacementLength() and replace it by the commitString(). If-
1978 replacementLength() is 0, replacementStart() gives the insertion-
1979 position for the commitString().-
1980-
1981 When doing replacement the area of the preedit-
1982 string is ignored, thus a replacement starting at -1 with a length-
1983 of 2 will remove the last character before the preedit string and-
1984 the first character afterwards, and insert the commit string-
1985 directly before the preedit string.-
1986-
1987 If the widget implements undo/redo, this operation gets added to-
1988 the undo stack.-
1989-
1990 \li If there is no current preedit string, insert the-
1991 preeditString() at the current cursor position; otherwise replace-
1992 the previous preeditString with the one received from this event.-
1993-
1994 If the widget implements undo/redo, the preeditString() should not-
1995 influence the undo/redo stack in any way.-
1996-
1997 The widget should examine the list of attributes to apply to the-
1998 preedit string. It has to understand at least the TextFormat and-
1999 Cursor attributes and render them as specified.-
2000 \endlist-
2001-
2002 \sa QInputMethod-
2003*/-
2004-
2005/*!-
2006 \enum QInputMethodEvent::AttributeType-
2007-
2008 \value TextFormat-
2009 A QTextCharFormat for the part of the preedit string specified by-
2010 start and length. value contains a QVariant of type QTextFormat-
2011 specifying rendering of this part of the preedit string. There-
2012 should be at most one format for every part of the preedit-
2013 string. If several are specified for any character in the string the-
2014 behaviour is undefined. A conforming implementation has to at least-
2015 honor the backgroundColor, textColor and fontUnderline properties-
2016 of the format.-
2017-
2018 \value Cursor If set, a cursor should be shown inside the preedit-
2019 string at position start. The length variable determines whether-
2020 the cursor is visible or not. If the length is 0 the cursor is-
2021 invisible. If value is a QVariant of type QColor this color will-
2022 be used for rendering the cursor, otherwise the color of the-
2023 surrounding text will be used. There should be at most one Cursor-
2024 attribute per event. If several are specified the behaviour is-
2025 undefined.-
2026-
2027 \value Language-
2028 The variant contains a QLocale object specifying the language of a-
2029 certain part of the preedit string. There should be at most one-
2030 language set for every part of the preedit string. If several are-
2031 specified for any character in the string the behavior is undefined.-
2032-
2033 \value Ruby-
2034 The ruby text for a part of the preedit string. There should be at-
2035 most one ruby text set for every part of the preedit string. If-
2036 several are specified for any character in the string the behaviour-
2037 is undefined.-
2038-
2039 \value Selection-
2040 If set, the edit cursor should be moved to the specified position-
2041 in the editor text contents. In contrast with \c Cursor, this-
2042 attribute does not work on the preedit text, but on the surrounding-
2043 text. The cursor will be moved after the commit string has been-
2044 committed, and the preedit string will be located at the new edit-
2045 position.-
2046 The start position specifies the new position and the length-
2047 variable can be used to set a selection starting from that point.-
2048 The value is unused.-
2049-
2050 \sa Attribute-
2051*/-
2052-
2053/*!-
2054 \class QInputMethodEvent::Attribute-
2055 \inmodule QtGui-
2056 \brief The QInputMethodEvent::Attribute class stores an input method attribute.-
2057*/-
2058-
2059/*!-
2060 \fn QInputMethodEvent::Attribute::Attribute(AttributeType type, int start, int length, QVariant value)-
2061-
2062 Constructs an input method attribute. \a type specifies the type-
2063 of attribute, \a start and \a length the position of the-
2064 attribute, and \a value the value of the attribute.-
2065*/-
2066-
2067/*!-
2068 Constructs an event of type QEvent::InputMethod. The-
2069 attributes(), preeditString(), commitString(), replacementStart(),-
2070 and replacementLength() are initialized to default values.-
2071-
2072 \sa setCommitString()-
2073*/-
2074QInputMethodEvent::QInputMethodEvent()-
2075 : QEvent(QEvent::InputMethod), replace_from(0), replace_length(0)-
2076{-
2077}
never executed: end of block
0
2078-
2079/*!-
2080 Constructs an event of type QEvent::InputMethod. The-
2081 preedit text is set to \a preeditText, the attributes to-
2082 \a attributes.-
2083-
2084 The commitString(), replacementStart(), and replacementLength()-
2085 values can be set using setCommitString().-
2086-
2087 \sa preeditString(), attributes()-
2088*/-
2089QInputMethodEvent::QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes)-
2090 : QEvent(QEvent::InputMethod), preedit(preeditText), attrs(attributes),-
2091 replace_from(0), replace_length(0)-
2092{-
2093}
never executed: end of block
0
2094-
2095/*!-
2096 Constructs a copy of \a other.-
2097*/-
2098QInputMethodEvent::QInputMethodEvent(const QInputMethodEvent &other)-
2099 : QEvent(QEvent::InputMethod), preedit(other.preedit), attrs(other.attrs),-
2100 commit(other.commit), replace_from(other.replace_from), replace_length(other.replace_length)-
2101{-
2102}
never executed: end of block
0
2103-
2104QInputMethodEvent::~QInputMethodEvent()-
2105{-
2106 // must be empty until ### Qt 6-
2107}-
2108-
2109/*!-
2110 Sets the commit string to \a commitString.-
2111-
2112 The commit string is the text that should get added to (or-
2113 replace parts of) the text of the editor widget. It usually is a-
2114 result of the input operations and has to be inserted to the-
2115 widgets text directly before the preedit string.-
2116-
2117 If the commit string should replace parts of the of the text in-
2118 the editor, \a replaceLength specifies the number of-
2119 characters to be replaced. \a replaceFrom specifies the position-
2120 at which characters are to be replaced relative from the start of-
2121 the preedit string.-
2122-
2123 \sa commitString(), replacementStart(), replacementLength()-
2124*/-
2125void QInputMethodEvent::setCommitString(const QString &commitString, int replaceFrom, int replaceLength)-
2126{-
2127 commit = commitString;-
2128 replace_from = replaceFrom;-
2129 replace_length = replaceLength;-
2130}
never executed: end of block
0
2131-
2132/*!-
2133 \fn const QList<Attribute> &QInputMethodEvent::attributes() const-
2134-
2135 Returns the list of attributes passed to the QInputMethodEvent-
2136 constructor. The attributes control the visual appearance of the-
2137 preedit string (the visual appearance of text outside the preedit-
2138 string is controlled by the widget only).-
2139-
2140 \sa preeditString(), Attribute-
2141*/-
2142-
2143/*!-
2144 \fn const QString &QInputMethodEvent::preeditString() const-
2145-
2146 Returns the preedit text, i.e. the text before the user started-
2147 editing it.-
2148-
2149 \sa commitString(), attributes()-
2150*/-
2151-
2152/*!-
2153 \fn const QString &QInputMethodEvent::commitString() const-
2154-
2155 Returns the text that should get added to (or replace parts of)-
2156 the text of the editor widget. It usually is a result of the-
2157 input operations and has to be inserted to the widgets text-
2158 directly before the preedit string.-
2159-
2160 \sa setCommitString(), preeditString(), replacementStart(), replacementLength()-
2161*/-
2162-
2163/*!-
2164 \fn int QInputMethodEvent::replacementStart() const-
2165-
2166 Returns the position at which characters are to be replaced relative-
2167 from the start of the preedit string.-
2168-
2169 \sa replacementLength(), setCommitString()-
2170*/-
2171-
2172/*!-
2173 \fn int QInputMethodEvent::replacementLength() const-
2174-
2175 Returns the number of characters to be replaced in the preedit-
2176 string.-
2177-
2178 \sa replacementStart(), setCommitString()-
2179*/-
2180-
2181/*!-
2182 \class QInputMethodQueryEvent-
2183 \since 5.0-
2184 \inmodule QtGui-
2185-
2186 \brief The QInputMethodQueryEvent class provides an event sent by the input context to input objects.-
2187-
2188 It is used by the-
2189 input method to query a set of properties of the object to be-
2190 able to support complex input method operations as support for-
2191 surrounding text and reconversions.-
2192-
2193 queries() specifies which properties are queried.-
2194-
2195 The object should call setValue() on the event to fill in the requested-
2196 data before calling accept().-
2197*/-
2198-
2199/*!-
2200 \fn Qt::InputMethodQueries QInputMethodQueryEvent::queries() const-
2201-
2202 Returns the properties queried by the event.-
2203 */-
2204-
2205/*!-
2206 Constructs a query event for properties given by \a queries.-
2207 */-
2208QInputMethodQueryEvent::QInputMethodQueryEvent(Qt::InputMethodQueries queries)-
2209 : QEvent(InputMethodQuery),-
2210 m_queries(queries)-
2211{-
2212}
never executed: end of block
0
2213-
2214/*!-
2215 \internal-
2216 */-
2217QInputMethodQueryEvent::~QInputMethodQueryEvent()-
2218{-
2219}-
2220-
2221/*!-
2222 Sets property \a query to \a value.-
2223 */-
2224void QInputMethodQueryEvent::setValue(Qt::InputMethodQuery query, const QVariant &value)-
2225{-
2226 for (int i = 0; i < m_values.size(); ++i) {
i < m_values.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
2227 if (m_values.at(i).query == query) {
m_values.at(i).query == queryDescription
TRUEnever evaluated
FALSEnever evaluated
0
2228 m_values[i].value = value;-
2229 return;
never executed: return;
0
2230 }-
2231 }
never executed: end of block
0
2232 QueryPair pair = { query, value };-
2233 m_values.append(pair);-
2234}
never executed: end of block
0
2235-
2236/*!-
2237 Returns value of the property \a query.-
2238 */-
2239QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query) const-
2240{-
2241 for (int i = 0; i < m_values.size(); ++i)
i < m_values.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
2242 if (m_values.at(i).query == query)
m_values.at(i).query == queryDescription
TRUEnever evaluated
FALSEnever evaluated
0
2243 return m_values.at(i).value;
never executed: return m_values.at(i).value;
0
2244 return QVariant();
never executed: return QVariant();
0
2245}-
2246-
2247#ifndef QT_NO_TABLETEVENT-
2248-
2249/*!-
2250 \class QTabletEvent-
2251 \brief The QTabletEvent class contains parameters that describe a Tablet event.-
2252 \inmodule QtGui-
2253-
2254 \ingroup events-
2255-
2256 \e{Tablet events} are generated from tablet peripherals such as Wacom-
2257 tablets and various other brands, and electromagnetic stylus devices-
2258 included with some types of tablet computers. (It is not the same as-
2259 \l QTouchEvent which a touchscreen generates, even when a passive stylus is-
2260 used on a touchscreen.)-
2261-
2262 Tablet events are similar to mouse events; for example, the \l x(), \l y(),-
2263 \l pos(), \l globalX(), \l globalY(), and \l globalPos() accessors provide-
2264 the cursor position, and you can see which \l buttons() are pressed-
2265 (pressing the stylus tip against the tablet surface is equivalent to a left-
2266 mouse button). But tablet events also pass through some extra information-
2267 that the tablet device driver provides; for example, you might want to do-
2268 subpixel rendering with higher resolution coordinates (\l hiResGlobalX()-
2269 and \l hiResGlobalY()), adjust color brightness based on the \l pressure()-
2270 of the tool against the tablet surface, use different brushes depending on-
2271 the type of tool in use (\l device()), modulate the brush shape in some way-
2272 according to the X-axis and Y-axis tilt of the tool with respect to the-
2273 tablet surface (\l xTilt() and \l yTilt()), and use a virtual eraser-
2274 instead of a brush if the user switches to the other end of a double-ended-
2275 stylus (\l pointerType()).-
2276-
2277 Every event contains an accept flag that indicates whether the receiver-
2278 wants the event. You should call QTabletEvent::accept() if you handle the-
2279 tablet event; otherwise it will be sent to the parent widget. The exception-
2280 are TabletEnterProximity and TabletLeaveProximity events: these are only-
2281 sent to QApplication and do not check whether or not they are accepted.-
2282-
2283 The QWidget::setEnabled() function can be used to enable or disable-
2284 mouse, tablet and keyboard events for a widget.-
2285-
2286 The event handler QWidget::tabletEvent() receives TabletPress,-
2287 TabletRelease and TabletMove events. Qt will first send a-
2288 tablet event, then if it is not accepted by any widget, it will send a-
2289 mouse event. This allows users of applications that are not designed for-
2290 tablets to use a tablet like a mouse. However high-resolution drawing-
2291 applications should handle the tablet events, because they can occur at a-
2292 higher frequency, which is a benefit for smooth and accurate drawing.-
2293 If the tablet events are rejected, the synthetic mouse events may be-
2294 compressed for efficiency.-
2295-
2296 New in Qt 5.4: QTabletEvent includes all information available from the-
2297 device, including \l QTabletEvent::buttons(). Previously it was not-
2298 possible to accept all tablet events and also know which stylus buttons-
2299 were pressed.-
2300-
2301 Note that pressing the stylus button while the stylus hovers over the-
2302 tablet will generate a button press on some types of tablets, while on-
2303 other types it will be necessary to press the stylus against the tablet-
2304 surface in order to register the simultaneous stylus button press.-
2305-
2306 \section1 Notes for X11 Users-
2307-
2308 If the tablet is configured in xorg.conf to use the Wacom driver, there-
2309 will be separate XInput "devices" for the stylus, eraser, and (optionally)-
2310 cursor and touchpad. Qt recognizes these by their names. Otherwise, if the-
2311 tablet is configured to use the evdev driver, there will be only one device-
2312 and applications may not be able to distinguish the stylus from the eraser.-
2313*/-
2314-
2315/*!-
2316 \enum QTabletEvent::TabletDevice-
2317-
2318 This enum defines what type of device is generating the event.-
2319-
2320 \value NoDevice No device, or an unknown device.-
2321 \value Puck A Puck (a device that is similar to a flat mouse with-
2322 a transparent circle with cross-hairs).-
2323 \value Stylus A Stylus.-
2324 \value Airbrush An airbrush-
2325 \value FourDMouse A 4D Mouse.-
2326 \value RotationStylus A special stylus that also knows about rotation-
2327 (a 6D stylus). \since 4.1-
2328 \omitvalue XFreeEraser-
2329*/-
2330-
2331/*!-
2332 \enum QTabletEvent::PointerType-
2333-
2334 This enum defines what type of point is generating the event.-
2335-
2336 \value UnknownPointer An unknown device.-
2337 \value Pen Tip end of a stylus-like device (the narrow end of the pen).-
2338 \value Cursor Any puck-like device.-
2339 \value Eraser Eraser end of a stylus-like device (the broad end of the pen).-
2340-
2341 \sa pointerType()-
2342*/-
2343-
2344/*!-
2345 Construct a tablet event of the given \a type.-
2346-
2347 The \a pos parameter indicates where the event occurred in the-
2348 widget; \a globalPos is the corresponding position in absolute-
2349 coordinates.-
2350-
2351 \a pressure contains the pressure exerted on the \a device.-
2352-
2353 \a pointerType describes the type of pen that is being used.-
2354-
2355 \a xTilt and \a yTilt contain the device's degree of tilt from the-
2356 x and y axes respectively.-
2357-
2358 \a keyState specifies which keyboard modifiers are pressed (e.g.,-
2359 \uicontrol{Ctrl}).-
2360-
2361 The \a uniqueID parameter contains the unique ID for the current device.-
2362-
2363 The \a z parameter contains the coordinate of the device on the tablet, this-
2364 is usually given by a wheel on 4D mouse. If the device does not support a-
2365 Z-axis, pass zero here.-
2366-
2367 The \a tangentialPressure parameter contins the tangential pressure of an air-
2368 brush. If the device does not support tangential pressure, pass 0 here.-
2369-
2370 \a rotation contains the device's rotation in degrees. 4D mice and the Wacom-
2371 Art Pen support rotation. If the device does not support rotation, pass 0 here.-
2372-
2373 The \a button that caused the event is given as a value from the-
2374 \l Qt::MouseButton enum. If the event \a type is not \l TabletPress or-
2375 \l TabletRelease, the appropriate button for this event is \l Qt::NoButton.-
2376-
2377 \a buttons is the state of all buttons at the time of the event.-
2378-
2379 \sa pos(), globalPos(), device(), pressure(), xTilt(), yTilt(), uniqueId(), rotation(),-
2380 tangentialPressure(), z()-
2381*/-
2382-
2383QTabletEvent::QTabletEvent(Type type, const QPointF &pos, const QPointF &globalPos,-
2384 int device, int pointerType,-
2385 qreal pressure, int xTilt, int yTilt, qreal tangentialPressure,-
2386 qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID,-
2387 Qt::MouseButton button, Qt::MouseButtons buttons)-
2388 : QInputEvent(type, keyState),-
2389 mPos(pos),-
2390 mGPos(globalPos),-
2391 mDev(device),-
2392 mPointerType(pointerType),-
2393 mXT(xTilt),-
2394 mYT(yTilt),-
2395 mZ(z),-
2396 mPress(pressure),-
2397 mTangential(tangentialPressure),-
2398 mRot(rotation),-
2399 mUnique(uniqueID),-
2400 mExtra(new QTabletEventPrivate(button, buttons))-
2401{-
2402}
never executed: end of block
0
2403-
2404/*!-
2405 Construct a tablet event of the given \a type.-
2406-
2407 The \a pos parameter indicates where the event occurred in the-
2408 widget; \a globalPos is the corresponding position in absolute-
2409 coordinates.-
2410-
2411 \a pressure contains the pressure exerted on the \a device.-
2412-
2413 \a pointerType describes the type of pen that is being used.-
2414-
2415 \a xTilt and \a yTilt contain the device's degree of tilt from the-
2416 x and y axes respectively.-
2417-
2418 \a keyState specifies which keyboard modifiers are pressed (e.g.,-
2419 \uicontrol{Ctrl}).-
2420-
2421 The \a uniqueID parameter contains the unique ID for the current device.-
2422-
2423 The \a z parameter contains the coordinate of the device on the tablet, this-
2424 is usually given by a wheel on 4D mouse. If the device does not support a-
2425 Z-axis, pass zero here.-
2426-
2427 The \a tangentialPressure parameter contins the tangential pressure of an air-
2428 brush. If the device does not support tangential pressure, pass 0 here.-
2429-
2430 \a rotation contains the device's rotation in degrees. 4D mice support-
2431 rotation. If the device does not support rotation, pass 0 here.-
2432-
2433 \sa pos(), globalPos(), device(), pressure(), xTilt(), yTilt(), uniqueId(), rotation(),-
2434 tangentialPressure(), z()-
2435-
2436 \deprecated in 5.4: use the constructor with MouseButton status-
2437*/-
2438-
2439QTabletEvent::QTabletEvent(Type type, const QPointF &pos, const QPointF &globalPos,-
2440 int device, int pointerType,-
2441 qreal pressure, int xTilt, int yTilt, qreal tangentialPressure,-
2442 qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID)-
2443 : QInputEvent(type, keyState),-
2444 mPos(pos),-
2445 mGPos(globalPos),-
2446 mDev(device),-
2447 mPointerType(pointerType),-
2448 mXT(xTilt),-
2449 mYT(yTilt),-
2450 mZ(z),-
2451 mPress(pressure),-
2452 mTangential(tangentialPressure),-
2453 mRot(rotation),-
2454 mUnique(uniqueID),-
2455 mExtra(new QTabletEventPrivate(Qt::NoButton, Qt::NoButton))-
2456{-
2457}
never executed: end of block
0
2458-
2459/*!-
2460 \internal-
2461*/-
2462QTabletEvent::~QTabletEvent()-
2463{-
2464}-
2465-
2466/*!-
2467 Returns the button that caused the event.-
2468-
2469 Note that the returned value is always Qt::NoButton for \l TabletMove,-
2470 \l TabletEnterProximity and \l TabletLeaveProximity events.-
2471-
2472 \sa buttons(), Qt::MouseButton-
2473*/-
2474Qt::MouseButton QTabletEvent::button() const-
2475{-
2476 return static_cast<QTabletEventPrivate *>(mExtra)->b;
never executed: return static_cast<QTabletEventPrivate *>(mExtra)->b;
0
2477}-
2478-
2479/*!-
2480 Returns the button state when the event was generated. The button state is-
2481 a combination of buttons from the \l Qt::MouseButton enum using the OR-
2482 operator. For \l TabletMove events, this is all buttons that are pressed-
2483 down. For \l TabletPress events this includes the button that caused the-
2484 event. For \l TabletRelease events this excludes the button that caused the-
2485 event.-
2486-
2487 \sa button(), Qt::MouseButton-
2488*/-
2489Qt::MouseButtons QTabletEvent::buttons() const-
2490{-
2491 return static_cast<QTabletEventPrivate *>(mExtra)->buttonState;
never executed: return static_cast<QTabletEventPrivate *>(mExtra)->buttonState;
0
2492}-
2493-
2494/*!-
2495 \fn TabletDevices QTabletEvent::device() const-
2496-
2497 Returns the type of device that generated the event.-
2498-
2499 \sa TabletDevice-
2500*/-
2501-
2502/*!-
2503 \fn PointerType QTabletEvent::pointerType() const-
2504-
2505 Returns the type of point that generated the event.-
2506*/-
2507-
2508/*!-
2509 \fn qreal QTabletEvent::tangentialPressure() const-
2510-
2511 Returns the tangential pressure for the device. This is typically given by a finger-
2512 wheel on an airbrush tool. The range is from -1.0 to 1.0. 0.0 indicates a-
2513 neutral position. Current airbrushes can only move in the positive-
2514 direction from the neutrual position. If the device does not support-
2515 tangential pressure, this value is always 0.0.-
2516-
2517 \sa pressure()-
2518*/-
2519-
2520/*!-
2521 \fn qreal QTabletEvent::rotation() const-
2522-
2523 Returns the rotation of the current device in degress. This is usually-
2524 given by a 4D Mouse. If the device does not support rotation this value is-
2525 always 0.0.-
2526-
2527*/-
2528-
2529/*!-
2530 \fn qreal QTabletEvent::pressure() const-
2531-
2532 Returns the pressure for the device. 0.0 indicates that the stylus is not-
2533 on the tablet, 1.0 indicates the maximum amount of pressure for the stylus.-
2534-
2535 \sa tangentialPressure()-
2536*/-
2537-
2538/*!-
2539 \fn int QTabletEvent::xTilt() const-
2540-
2541 Returns the angle between the device (a pen, for example) and the-
2542 perpendicular in the direction of the x axis.-
2543 Positive values are towards the tablet's physical right. The angle-
2544 is in the range -60 to +60 degrees.-
2545-
2546 \image qtabletevent-tilt.png-
2547-
2548 \sa yTilt()-
2549*/-
2550-
2551/*!-
2552 \fn int QTabletEvent::yTilt() const-
2553-
2554 Returns the angle between the device (a pen, for example) and the-
2555 perpendicular in the direction of the y axis.-
2556 Positive values are towards the bottom of the tablet. The angle is-
2557 within the range -60 to +60 degrees.-
2558-
2559 \sa xTilt()-
2560*/-
2561-
2562/*!-
2563 \fn QPoint QTabletEvent::pos() const-
2564-
2565 Returns the position of the device, relative to the widget that-
2566 received the event.-
2567-
2568 If you move widgets around in response to mouse events, use-
2569 globalPos() instead of this function.-
2570-
2571 \sa x(), y(), globalPos()-
2572*/-
2573-
2574/*!-
2575 \fn int QTabletEvent::x() const-
2576-
2577 Returns the x position of the device, relative to the widget that-
2578 received the event.-
2579-
2580 \sa y(), pos()-
2581*/-
2582-
2583/*!-
2584 \fn int QTabletEvent::y() const-
2585-
2586 Returns the y position of the device, relative to the widget that-
2587 received the event.-
2588-
2589 \sa x(), pos()-
2590*/-
2591-
2592/*!-
2593 \fn int QTabletEvent::z() const-
2594-
2595 Returns the z position of the device. Typically this is represented by a-
2596 wheel on a 4D Mouse. If the device does not support a Z-axis, this value is-
2597 always zero. This is \b not the same as pressure.-
2598-
2599 \sa pressure()-
2600*/-
2601-
2602/*!-
2603 \fn QPoint QTabletEvent::globalPos() const-
2604-
2605 Returns the global position of the device \e{at the time of the-
2606 event}. This is important on asynchronous windows systems like X11;-
2607 whenever you move your widgets around in response to mouse events,-
2608 globalPos() can differ significantly from the current position-
2609 QCursor::pos().-
2610-
2611 \sa globalX(), globalY(), hiResGlobalPos()-
2612*/-
2613-
2614/*!-
2615 \fn int QTabletEvent::globalX() const-
2616-
2617 Returns the global x position of the mouse pointer at the time of-
2618 the event.-
2619-
2620 \sa globalY(), globalPos(), hiResGlobalX()-
2621*/-
2622-
2623/*!-
2624 \fn int QTabletEvent::globalY() const-
2625-
2626 Returns the global y position of the tablet device at the time of-
2627 the event.-
2628-
2629 \sa globalX(), globalPos(), hiResGlobalY()-
2630*/-
2631-
2632/*!-
2633 \fn qint64 QTabletEvent::uniqueId() const-
2634-
2635 Returns a unique ID for the current device, making it possible-
2636 to differentiate between multiple devices being used at the same-
2637 time on the tablet.-
2638-
2639 Support of this feature is dependent on the tablet.-
2640-
2641 Values for the same device may vary from OS to OS.-
2642-
2643 Later versions of the Wacom driver for Linux will now report-
2644 the ID information. If you have a tablet that supports unique ID-
2645 and are not getting the information on Linux, consider upgrading-
2646 your driver.-
2647-
2648 As of Qt 4.2, the unique ID is the same regardless of the orientation-
2649 of the pen. Earlier versions would report a different value when using-
2650 the eraser-end versus the pen-end of the stylus on some OS's.-
2651-
2652 \sa pointerType()-
2653*/-
2654-
2655/*!-
2656 \fn const QPointF &QTabletEvent::hiResGlobalPos() const-
2657-
2658 The high precision coordinates delivered from the tablet expressed.-
2659 Sub pixeling information is in the fractional part of the QPointF.-
2660-
2661 \sa globalPos(), hiResGlobalX(), hiResGlobalY()-
2662*/-
2663-
2664/*!-
2665 \fn qreal &QTabletEvent::hiResGlobalX() const-
2666-
2667 The high precision x position of the tablet device.-
2668*/-
2669-
2670/*!-
2671 \fn qreal &QTabletEvent::hiResGlobalY() const-
2672-
2673 The high precision y position of the tablet device.-
2674*/-
2675-
2676/*!-
2677 \fn const QPointF &QTabletEvent::posF() const-
2678-
2679 Returns the position of the device, relative to the widget that-
2680 received the event.-
2681-
2682 If you move widgets around in response to mouse events, use-
2683 globalPosF() instead of this function.-
2684-
2685 \sa globalPosF()-
2686*/-
2687-
2688/*!-
2689 \fn const QPointF &QTabletEvent::globalPosF() const-
2690-
2691 Returns the global position of the device \e{at the time of the-
2692 event}. This is important on asynchronous windows systems like X11;-
2693 whenever you move your widgets around in response to mouse events,-
2694 globalPosF() can differ significantly from the current position-
2695 QCursor::pos().-
2696-
2697 \sa posF()-
2698*/-
2699-
2700#endif // QT_NO_TABLETEVENT-
2701-
2702#ifndef QT_NO_GESTURES-
2703/*!-
2704 \class QNativeGestureEvent-
2705 \since 5.2-
2706 \brief The QNativeGestureEvent class contains parameters that describe a gesture event.-
2707 \inmodule QtGui-
2708 \ingroup events-
2709-
2710 Native gesture events are generated by the operating system, typically by-
2711 interpreting touch events. Gesture events are high-level events such-
2712 as zoom or rotate.-
2713-
2714 \table-
2715 \header-
2716 \li Event Type-
2717 \li Description-
2718 \li Touch equence-
2719 \row-
2720 \li Qt::ZoomNativeGesture-
2721 \li Magnification delta in percent.-
2722 \li \macos: Two-finger pinch.-
2723 \row-
2724 \li Qt::SmartZoomNativeGesture-
2725 \li Boolean magnification state.-
2726 \li \macos: Two-finger douple tap (trackpad) / One-finger douple tap (magic mouse).-
2727 \row-
2728 \li Qt::RotateNativeGesture-
2729 \li Rotation delta in degrees.-
2730 \li \macos: Two-finger rotate.-
2731 \endtable-
2732-
2733-
2734 In addition, BeginNativeGesture and EndNativeGesture are sent before and after-
2735 gesture event streams:-
2736-
2737 BeginNativeGesture-
2738 ZoomNativeGesture-
2739 ZoomNativeGesture-
2740 ZoomNativeGesture-
2741 EndNativeGesture-
2742-
2743 \sa Qt::NativeGestureType, QGestureEvent-
2744*/-
2745-
2746/*!-
2747 Constructs a native gesture event of type \a type.-
2748-
2749 The points \a localPos, \a windowPos and \a screenPos specify the-
2750 gesture position relative to the receiving widget or item,-
2751 window, and screen, respectively.-
2752-
2753 \a realValue is the \macos event parameter, \a sequenceId and \a intValue are the Windows event parameters.-
2754*/-
2755QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos,-
2756 const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)-
2757 : QInputEvent(QEvent::NativeGesture), mGestureType(type),-
2758 mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue),-
2759 mSequenceId(sequenceId), mIntValue(intValue)-
2760{
never executed: end of block
}
never executed: end of block
0
2761-
2762/*!-
2763 \fn QNativeGestureEvent::gestureType() const-
2764 \since 5.2-
2765-
2766 Returns the gesture type.-
2767*/-
2768-
2769/*!-
2770 \fn QNativeGestureEvent::value() const-
2771 \since 5.2-
2772-
2773 Returns the gesture value. The value should be interpreted based on the-
2774 gesture type. For example, a Zoom gesture provides a scale factor while a Rotate-
2775 gesture provides a rotation delta.-
2776-
2777 \sa QNativeGestureEvent, gestureType()-
2778*/-
2779-
2780/*!-
2781 \fn QPoint QNativeGestureEvent::globalPos() const-
2782 \since 5.2-
2783-
2784 Returns the position of the gesture as a QPointF in screen coordinates-
2785*/-
2786-
2787/*!-
2788 \fn QPoint QNativeGestureEvent::pos() const-
2789 \since 5.2-
2790-
2791 Returns the position of the mouse cursor, relative to the widget-
2792 or item that received the event.-
2793*/-
2794-
2795/*!-
2796 \fn QPointF QNativeGestureEvent::localPos() const-
2797 \since 5.2-
2798-
2799 Returns the position of the gesture as a QPointF, relative to the-
2800 widget or item that received the event.-
2801*/-
2802-
2803/*!-
2804 \fn QPointF QNativeGestureEvent::screenPos() const-
2805 \since 5.2-
2806-
2807 Returns the position of the gesture as a QPointF in screen coordinates.-
2808*/-
2809-
2810/*!-
2811 \fn QPointF QNativeGestureEvent::windowPos() const-
2812 \since 5.2-
2813-
2814 Returns the position of the gesture as a QPointF, relative to the-
2815 window that received the event.-
2816*/-
2817#endif // QT_NO_GESTURES-
2818-
2819#ifndef QT_NO_DRAGANDDROP-
2820/*!-
2821 Creates a QDragMoveEvent of the required \a type indicating-
2822 that the mouse is at position \a pos given within a widget.-
2823-
2824 The mouse and keyboard states are specified by \a buttons and-
2825 \a modifiers, and the \a actions describe the types of drag-
2826 and drop operation that are possible.-
2827 The drag data is passed as MIME-encoded information in \a data.-
2828-
2829 \warning Do not attempt to create a QDragMoveEvent yourself.-
2830 These objects rely on Qt's internal state.-
2831*/-
2832QDragMoveEvent::QDragMoveEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data,-
2833 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)-
2834 : QDropEvent(pos, actions, data, buttons, modifiers, type)-
2835 , rect(pos, QSize(1, 1))-
2836{}
never executed: end of block
0
2837-
2838/*!-
2839 Destroys the event.-
2840*/-
2841QDragMoveEvent::~QDragMoveEvent()-
2842{-
2843}-
2844-
2845/*!-
2846 \fn void QDragMoveEvent::accept(const QRect &rectangle)-
2847-
2848 The same as accept(), but also notifies that future moves will-
2849 also be acceptable if they remain within the \a rectangle-
2850 given on the widget. This can improve performance, but may-
2851 also be ignored by the underlying system.-
2852-
2853 If the rectangle is empty, drag move events will be sent-
2854 continuously. This is useful if the source is scrolling in a-
2855 timer event.-
2856*/-
2857-
2858/*!-
2859 \fn void QDragMoveEvent::accept()-
2860-
2861 \overload-
2862-
2863 Calls QDropEvent::accept().-
2864*/-
2865-
2866/*!-
2867 \fn void QDragMoveEvent::ignore()-
2868-
2869 \overload-
2870-
2871 Calls QDropEvent::ignore().-
2872*/-
2873-
2874/*!-
2875 \fn void QDragMoveEvent::ignore(const QRect &rectangle)-
2876-
2877 The opposite of the accept(const QRect&) function.-
2878 Moves within the \a rectangle are not acceptable, and will be-
2879 ignored.-
2880*/-
2881-
2882/*!-
2883 \fn QRect QDragMoveEvent::answerRect() const-
2884-
2885 Returns the rectangle in the widget where the drop will occur if accepted.-
2886 You can use this information to restrict drops to certain places on the-
2887 widget.-
2888*/-
2889-
2890-
2891/*!-
2892 \class QDropEvent-
2893 \ingroup events-
2894 \ingroup draganddrop-
2895 \inmodule QtGui-
2896-
2897 \brief The QDropEvent class provides an event which is sent when a-
2898 drag and drop action is completed.-
2899-
2900 When a widget \l{QWidget::setAcceptDrops()}{accepts drop events}, it will-
2901 receive this event if it has accepted the most recent QDragEnterEvent or-
2902 QDragMoveEvent sent to it.-
2903-
2904 The drop event contains a proposed action, available from proposedAction(), for-
2905 the widget to either accept or ignore. If the action can be handled by the-
2906 widget, you should call the acceptProposedAction() function. Since the-
2907 proposed action can be a combination of \l Qt::DropAction values, it may be-
2908 useful to either select one of these values as a default action or ask-
2909 the user to select their preferred action.-
2910-
2911 If the proposed drop action is not suitable, perhaps because your custom-
2912 widget does not support that action, you can replace it with any of the-
2913 \l{possibleActions()}{possible drop actions} by calling setDropAction()-
2914 with your preferred action. If you set a value that is not present in the-
2915 bitwise OR combination of values returned by possibleActions(), the default-
2916 copy action will be used. Once a replacement drop action has been set, call-
2917 accept() instead of acceptProposedAction() to complete the drop operation.-
2918-
2919 The mimeData() function provides the data dropped on the widget in a QMimeData-
2920 object. This contains information about the MIME type of the data in addition to-
2921 the data itself.-
2922-
2923 \sa QMimeData, QDrag, {Drag and Drop}-
2924*/-
2925-
2926/*!-
2927 \fn const QMimeData *QDropEvent::mimeData() const-
2928-
2929 Returns the data that was dropped on the widget and its associated MIME-
2930 type information.-
2931*/-
2932-
2933/*!-
2934 Constructs a drop event of a certain \a type corresponding to a-
2935 drop at the point specified by \a pos in the destination widget's-
2936 coordinate system.-
2937-
2938 The \a actions indicate which types of drag and drop operation can-
2939 be performed, and the drag data is stored as MIME-encoded data in \a data.-
2940-
2941 The states of the mouse buttons and keyboard modifiers at the time of-
2942 the drop are specified by \a buttons and \a modifiers.-
2943*/ // ### pos is in which coordinate system?-
2944QDropEvent::QDropEvent(const QPointF& pos, Qt::DropActions actions, const QMimeData *data,-
2945 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)-
2946 : QEvent(type), p(pos), mouseState(buttons),-
2947 modState(modifiers), act(actions),-
2948 mdata(data)-
2949{-
2950 default_action = QGuiApplicationPrivate::platformIntegration()->drag()->defaultAction(act, modifiers);-
2951 drop_action = default_action;-
2952 ignore();-
2953}
never executed: end of block
0
2954-
2955/*! \internal */-
2956QDropEvent::~QDropEvent()-
2957{-
2958}-
2959-
2960-
2961/*!-
2962 If the source of the drag operation is a widget in this-
2963 application, this function returns that source; otherwise it-
2964 returns 0. The source of the operation is the first parameter to-
2965 the QDrag object used instantiate the drag.-
2966-
2967 This is useful if your widget needs special behavior when dragging-
2968 to itself.-
2969-
2970 \sa QDrag::QDrag()-
2971*/-
2972QObject* QDropEvent::source() const-
2973{-
2974 if (const QDragManager *manager = QDragManager::self())
const QDragMan...anager::self()Description
TRUEnever evaluated
FALSEnever evaluated
0
2975 return manager->source();
never executed: return manager->source();
0
2976 return 0;
never executed: return 0;
0
2977}-
2978-
2979-
2980void QDropEvent::setDropAction(Qt::DropAction action)-
2981{-
2982 if (!(action & act) && action != Qt::IgnoreAction)
!(action & act)Description
TRUEnever evaluated
FALSEnever evaluated
action != Qt::IgnoreActionDescription
TRUEnever evaluated
FALSEnever evaluated
0
2983 action = default_action;
never executed: action = default_action;
0
2984 drop_action = action;-
2985}
never executed: end of block
0
2986-
2987/*!-
2988 \fn QPoint QDropEvent::pos() const-
2989-
2990 Returns the position where the drop was made.-
2991*/-
2992-
2993/*!-
2994 \fn const QPointF& QDropEvent::posF() const-
2995-
2996 Returns the position where the drop was made.-
2997*/-
2998-
2999/*!-
3000 \fn Qt::MouseButtons QDropEvent::mouseButtons() const-
3001-
3002 Returns the mouse buttons that are pressed..-
3003*/-
3004-
3005/*!-
3006 \fn Qt::KeyboardModifiers QDropEvent::keyboardModifiers() const-
3007-
3008 Returns the modifier keys that are pressed.-
3009*/-
3010-
3011/*!-
3012 \fn void QDropEvent::setDropAction(Qt::DropAction action)-
3013-
3014 Sets the \a action to be performed on the data by the target.-
3015 Use this to override the \l{proposedAction()}{proposed action}-
3016 with one of the \l{possibleActions()}{possible actions}.-
3017-
3018 If you set a drop action that is not one of the possible actions, the-
3019 drag and drop operation will default to a copy operation.-
3020-
3021 Once you have supplied a replacement drop action, call accept()-
3022 instead of acceptProposedAction().-
3023-
3024 \sa dropAction()-
3025*/-
3026-
3027/*!-
3028 \fn Qt::DropAction QDropEvent::dropAction() const-
3029-
3030 Returns the action to be performed on the data by the target. This may be-
3031 different from the action supplied in proposedAction() if you have called-
3032 setDropAction() to explicitly choose a drop action.-
3033-
3034 \sa setDropAction()-
3035*/-
3036-
3037/*!-
3038 \fn Qt::DropActions QDropEvent::possibleActions() const-
3039-
3040 Returns an OR-combination of possible drop actions.-
3041-
3042 \sa dropAction()-
3043*/-
3044-
3045/*!-
3046 \fn Qt::DropAction QDropEvent::proposedAction() const-
3047-
3048 Returns the proposed drop action.-
3049-
3050 \sa dropAction()-
3051*/-
3052-
3053/*!-
3054 \fn void QDropEvent::acceptProposedAction()-
3055-
3056 Sets the drop action to be the proposed action.-
3057-
3058 \sa setDropAction(), proposedAction(), {QEvent::accept()}{accept()}-
3059*/-
3060-
3061/*!-
3062 \class QDragEnterEvent-
3063 \brief The QDragEnterEvent class provides an event which is sent-
3064 to a widget when a drag and drop action enters it.-
3065-
3066 \ingroup events-
3067 \ingroup draganddrop-
3068 \inmodule QtGui-
3069-
3070 A widget must accept this event in order to receive the \l-
3071 {QDragMoveEvent}{drag move events} that are sent while the drag-
3072 and drop action is in progress. The drag enter event is always-
3073 immediately followed by a drag move event.-
3074-
3075 QDragEnterEvent inherits most of its functionality from-
3076 QDragMoveEvent, which in turn inherits most of its functionality-
3077 from QDropEvent.-
3078-
3079 \sa QDragLeaveEvent, QDragMoveEvent, QDropEvent-
3080*/-
3081-
3082/*!-
3083 Constructs a QDragEnterEvent that represents a drag entering a-
3084 widget at the given \a point with mouse and keyboard states specified by-
3085 \a buttons and \a modifiers.-
3086-
3087 The drag data is passed as MIME-encoded information in \a data, and the-
3088 specified \a actions describe the possible types of drag and drop-
3089 operation that can be performed.-
3090-
3091 \warning Do not create a QDragEnterEvent yourself since these-
3092 objects rely on Qt's internal state.-
3093*/-
3094QDragEnterEvent::QDragEnterEvent(const QPoint& point, Qt::DropActions actions, const QMimeData *data,-
3095 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)-
3096 : QDragMoveEvent(point, actions, data, buttons, modifiers, DragEnter)-
3097{}
never executed: end of block
0
3098-
3099/*! \internal-
3100*/-
3101QDragEnterEvent::~QDragEnterEvent()-
3102{-
3103}-
3104-
3105/*!-
3106 \class QDragMoveEvent-
3107 \brief The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress.-
3108-
3109 \ingroup events-
3110 \ingroup draganddrop-
3111 \inmodule QtGui-
3112-
3113 A widget will receive drag move events repeatedly while the drag-
3114 is within its boundaries, if it accepts-
3115 \l{QWidget::setAcceptDrops()}{drop events} and \l-
3116 {QWidget::dragEnterEvent()}{enter events}. The widget should-
3117 examine the event to see what kind of \l{mimeData()}{data} it-
3118 provides, and call the accept() function to accept the drop if appropriate.-
3119-
3120 The rectangle supplied by the answerRect() function can be used to restrict-
3121 drops to certain parts of the widget. For example, we can check whether the-
3122 rectangle intersects with the geometry of a certain child widget and only-
3123 call \l{QDropEvent::acceptProposedAction()}{acceptProposedAction()} if that-
3124 is the case.-
3125-
3126 Note that this class inherits most of its functionality from-
3127 QDropEvent.-
3128-
3129 \sa QDragEnterEvent, QDragLeaveEvent, QDropEvent-
3130*/-
3131-
3132/*!-
3133 \class QDragLeaveEvent-
3134 \brief The QDragLeaveEvent class provides an event that is sent to a widget when a drag and drop action leaves it.-
3135-
3136 \ingroup events-
3137 \ingroup draganddrop-
3138 \inmodule QtGui-
3139-
3140 This event is always preceded by a QDragEnterEvent and a series-
3141 of \l{QDragMoveEvent}s. It is not sent if a QDropEvent is sent-
3142 instead.-
3143-
3144 \sa QDragEnterEvent, QDragMoveEvent, QDropEvent-
3145*/-
3146-
3147/*!-
3148 Constructs a QDragLeaveEvent.-
3149-
3150 \warning Do not create a QDragLeaveEvent yourself since these-
3151 objects rely on Qt's internal state.-
3152*/-
3153QDragLeaveEvent::QDragLeaveEvent()-
3154 : QEvent(DragLeave)-
3155{}
never executed: end of block
0
3156-
3157/*! \internal-
3158*/-
3159QDragLeaveEvent::~QDragLeaveEvent()-
3160{-
3161}-
3162#endif // QT_NO_DRAGANDDROP-
3163-
3164/*!-
3165 \class QHelpEvent-
3166 \brief The QHelpEvent class provides an event that is used to request helpful information-
3167 about a particular point in a widget.-
3168-
3169 \ingroup events-
3170 \ingroup helpsystem-
3171 \inmodule QtGui-
3172-
3173 This event can be intercepted in applications to provide tooltips-
3174 or "What's This?" help for custom widgets. The type() can be-
3175 either QEvent::ToolTip or QEvent::WhatsThis.-
3176-
3177 \sa QToolTip, QWhatsThis, QStatusTipEvent, QWhatsThisClickedEvent-
3178*/-
3179-
3180/*!-
3181 Constructs a help event with the given \a type corresponding to the-
3182 widget-relative position specified by \a pos and the global position-
3183 specified by \a globalPos.-
3184-
3185 \a type must be either QEvent::ToolTip or QEvent::WhatsThis.-
3186-
3187 \sa pos(), globalPos()-
3188*/-
3189QHelpEvent::QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos)-
3190 : QEvent(type), p(pos), gp(globalPos)-
3191{}
never executed: end of block
0
3192-
3193/*!-
3194 \fn int QHelpEvent::x() const-
3195-
3196 Same as pos().x().-
3197-
3198 \sa y(), pos(), globalPos()-
3199*/-
3200-
3201/*!-
3202 \fn int QHelpEvent::y() const-
3203-
3204 Same as pos().y().-
3205-
3206 \sa x(), pos(), globalPos()-
3207*/-
3208-
3209/*!-
3210 \fn int QHelpEvent::globalX() const-
3211-
3212 Same as globalPos().x().-
3213-
3214 \sa x(), globalY(), globalPos()-
3215*/-
3216-
3217/*!-
3218 \fn int QHelpEvent::globalY() const-
3219-
3220 Same as globalPos().y().-
3221-
3222 \sa y(), globalX(), globalPos()-
3223*/-
3224-
3225/*!-
3226 \fn const QPoint &QHelpEvent::pos() const-
3227-
3228 Returns the mouse cursor position when the event was generated,-
3229 relative to the widget to which the event is dispatched.-
3230-
3231 \sa globalPos(), x(), y()-
3232*/-
3233-
3234/*!-
3235 \fn const QPoint &QHelpEvent::globalPos() const-
3236-
3237 Returns the mouse cursor position when the event was generated-
3238 in global coordinates.-
3239-
3240 \sa pos(), globalX(), globalY()-
3241*/-
3242-
3243/*! \internal-
3244*/-
3245QHelpEvent::~QHelpEvent()-
3246{-
3247}-
3248-
3249#ifndef QT_NO_STATUSTIP-
3250-
3251/*!-
3252 \class QStatusTipEvent-
3253 \brief The QStatusTipEvent class provides an event that is used to show messages in a status bar.-
3254-
3255 \ingroup events-
3256 \ingroup helpsystem-
3257 \inmodule QtGui-
3258-
3259 Status tips can be set on a widget using the-
3260 QWidget::setStatusTip() function. They are shown in the status-
3261 bar when the mouse cursor enters the widget. For example:-
3262-
3263 \table 100%-
3264 \row-
3265 \li-
3266 \snippet qstatustipevent/main.cpp 1-
3267 \dots-
3268 \snippet qstatustipevent/main.cpp 3-
3269 \li-
3270 \image qstatustipevent-widget.png Widget with status tip.-
3271 \endtable-
3272-
3273 Status tips can also be set on actions using the-
3274 QAction::setStatusTip() function:-
3275-
3276 \table 100%-
3277 \row-
3278 \li-
3279 \snippet qstatustipevent/main.cpp 0-
3280 \snippet qstatustipevent/main.cpp 2-
3281 \dots-
3282 \snippet qstatustipevent/main.cpp 3-
3283 \li-
3284 \image qstatustipevent-action.png Action with status tip.-
3285 \endtable-
3286-
3287 Finally, status tips are supported for the item view classes-
3288 through the Qt::StatusTipRole enum value.-
3289-
3290 \sa QStatusBar, QHelpEvent, QWhatsThisClickedEvent-
3291*/-
3292-
3293/*!-
3294 Constructs a status tip event with the text specified by \a tip.-
3295-
3296 \sa tip()-
3297*/-
3298QStatusTipEvent::QStatusTipEvent(const QString &tip)-
3299 : QEvent(StatusTip), s(tip)-
3300{}
never executed: end of block
0
3301-
3302/*! \internal-
3303*/-
3304QStatusTipEvent::~QStatusTipEvent()-
3305{-
3306}-
3307-
3308/*!-
3309 \fn QString QStatusTipEvent::tip() const-
3310-
3311 Returns the message to show in the status bar.-
3312-
3313 \sa QStatusBar::showMessage()-
3314*/-
3315-
3316#endif // QT_NO_STATUSTIP-
3317-
3318#ifndef QT_NO_WHATSTHIS-
3319-
3320/*!-
3321 \class QWhatsThisClickedEvent-
3322 \brief The QWhatsThisClickedEvent class provides an event that-
3323 can be used to handle hyperlinks in a "What's This?" text.-
3324-
3325 \ingroup events-
3326 \ingroup helpsystem-
3327 \inmodule QtGui-
3328-
3329 \sa QWhatsThis, QHelpEvent, QStatusTipEvent-
3330*/-
3331-
3332/*!-
3333 Constructs an event containing a URL specified by \a href when a link-
3334 is clicked in a "What's This?" message.-
3335-
3336 \sa href()-
3337*/-
3338QWhatsThisClickedEvent::QWhatsThisClickedEvent(const QString &href)-
3339 : QEvent(WhatsThisClicked), s(href)-
3340{}
never executed: end of block
0
3341-
3342/*! \internal-
3343*/-
3344QWhatsThisClickedEvent::~QWhatsThisClickedEvent()-
3345{-
3346}-
3347-
3348/*!-
3349 \fn QString QWhatsThisClickedEvent::href() const-
3350-
3351 Returns the URL that was clicked by the user in the "What's-
3352 This?" text.-
3353*/-
3354-
3355#endif // QT_NO_WHATSTHIS-
3356-
3357#ifndef QT_NO_ACTION-
3358-
3359/*!-
3360 \class QActionEvent-
3361 \brief The QActionEvent class provides an event that is generated-
3362 when a QAction is added, removed, or changed.-
3363-
3364 \ingroup events-
3365 \inmodule QtGui-
3366-
3367 Actions can be added to widgets using QWidget::addAction(). This-
3368 generates an \l ActionAdded event, which you can handle to provide-
3369 custom behavior. For example, QToolBar reimplements-
3370 QWidget::actionEvent() to create \l{QToolButton}s for the-
3371 actions.-
3372-
3373 \sa QAction, QWidget::addAction(), QWidget::removeAction(), QWidget::actions()-
3374*/-
3375-
3376/*!-
3377 Constructs an action event. The \a type can be \l ActionChanged,-
3378 \l ActionAdded, or \l ActionRemoved.-
3379-
3380 \a action is the action that is changed, added, or removed. If \a-
3381 type is ActionAdded, the action is to be inserted before the-
3382 action \a before. If \a before is 0, the action is appended.-
3383*/-
3384QActionEvent::QActionEvent(int type, QAction *action, QAction *before)-
3385 : QEvent(static_cast<QEvent::Type>(type)), act(action), bef(before)-
3386{}
never executed: end of block
0
3387-
3388/*! \internal-
3389*/-
3390QActionEvent::~QActionEvent()-
3391{-
3392}-
3393-
3394/*!-
3395 \fn QAction *QActionEvent::action() const-
3396-
3397 Returns the action that is changed, added, or removed.-
3398-
3399 \sa before()-
3400*/-
3401-
3402/*!-
3403 \fn QAction *QActionEvent::before() const-
3404-
3405 If type() is \l ActionAdded, returns the action that should-
3406 appear before action(). If this function returns 0, the action-
3407 should be appended to already existing actions on the same-
3408 widget.-
3409-
3410 \sa action(), QWidget::actions()-
3411*/-
3412-
3413#endif // QT_NO_ACTION-
3414-
3415/*!-
3416 \class QHideEvent-
3417 \brief The QHideEvent class provides an event which is sent after a widget is hidden.-
3418-
3419 \ingroup events-
3420 \inmodule QtGui-
3421-
3422 This event is sent just before QWidget::hide() returns, and also-
3423 when a top-level window has been hidden (iconified) by the user.-
3424-
3425 If spontaneous() is true, the event originated outside the-
3426 application. In this case, the user hid the window using the-
3427 window manager controls, either by iconifying the window or by-
3428 switching to another virtual desktop where the window is not-
3429 visible. The window will become hidden but not withdrawn. If the-
3430 window was iconified, QWidget::isMinimized() returns \c true.-
3431-
3432 \sa QShowEvent-
3433*/-
3434-
3435/*!-
3436 Constructs a QHideEvent.-
3437*/-
3438QHideEvent::QHideEvent()-
3439 : QEvent(Hide)-
3440{}
never executed: end of block
0
3441-
3442/*! \internal-
3443*/-
3444QHideEvent::~QHideEvent()-
3445{-
3446}-
3447-
3448/*!-
3449 \class QShowEvent-
3450 \brief The QShowEvent class provides an event that is sent when a widget is shown.-
3451-
3452 \ingroup events-
3453 \inmodule QtGui-
3454-
3455 There are two kinds of show events: show events caused by the-
3456 window system (spontaneous), and internal show events. Spontaneous (QEvent::spontaneous())-
3457 show events are sent just after the window system shows the-
3458 window; they are also sent when a top-level window is redisplayed-
3459 after being iconified. Internal show events are delivered just-
3460 before the widget becomes visible.-
3461-
3462 \sa QHideEvent-
3463*/-
3464-
3465/*!-
3466 Constructs a QShowEvent.-
3467*/-
3468QShowEvent::QShowEvent()-
3469 : QEvent(Show)-
3470{}
never executed: end of block
0
3471-
3472/*! \internal-
3473*/-
3474QShowEvent::~QShowEvent()-
3475{-
3476}-
3477-
3478/*!-
3479 \class QFileOpenEvent-
3480 \brief The QFileOpenEvent class provides an event that will be-
3481 sent when there is a request to open a file or a URL.-
3482-
3483 \ingroup events-
3484 \inmodule QtGui-
3485-
3486 File open events will be sent to the QApplication::instance()-
3487 when the operating system requests that a file or URL should be opened.-
3488 This is a high-level event that can be caused by different user actions-
3489 depending on the user's desktop environment; for example, double-
3490 clicking on an file icon in the Finder on \macos.-
3491-
3492 This event is only used to notify the application of a request.-
3493 It may be safely ignored.-
3494-
3495 \note This class is currently supported for \macos only.-
3496-
3497 \section1 \macos Example-
3498-
3499 In order to trigger the event on \macos, the application must be configured-
3500 to let the OS know what kind of file(s) it should react on.-
3501-
3502 For example, the following \c Info.plist file declares that the application-
3503 can act as a viewer for files with a PNG extension:-
3504-
3505 \snippet qfileopenevent/Info.plist Custom Info.plist-
3506-
3507 The following implementation of a QApplication subclass prints the path to-
3508 the file that was, for example, dropped on the Dock icon of the application.-
3509-
3510 \snippet qfileopenevent/main.cpp QApplication subclass-
3511*/-
3512-
3513/*!-
3514 \internal-
3515-
3516 Constructs a file open event for the given \a file.-
3517*/-
3518QFileOpenEvent::QFileOpenEvent(const QString &file)-
3519 : QEvent(FileOpen), f(file), m_url(QUrl::fromLocalFile(file))-
3520{-
3521}
never executed: end of block
0
3522-
3523/*!-
3524 \internal-
3525-
3526 Constructs a file open event for the given \a url.-
3527*/-
3528QFileOpenEvent::QFileOpenEvent(const QUrl &url)-
3529 : QEvent(FileOpen), f(url.toLocalFile()), m_url(url)-
3530{-
3531}
never executed: end of block
0
3532-
3533-
3534/*! \internal-
3535*/-
3536QFileOpenEvent::~QFileOpenEvent()-
3537{-
3538}-
3539-
3540/*!-
3541 \fn QString QFileOpenEvent::file() const-
3542-
3543 Returns the file that is being opened.-
3544*/-
3545-
3546/*!-
3547 \fn QUrl QFileOpenEvent::url() const-
3548-
3549 Returns the url that is being opened.-
3550-
3551 \since 4.6-
3552*/-
3553-
3554/*!-
3555 \fn bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const-
3556-
3557 Opens a QFile on the \a file referenced by this event in the mode specified-
3558 by \a flags. Returns \c true if successful; otherwise returns \c false.-
3559-
3560 This is necessary as some files cannot be opened by name, but require specific-
3561 information stored in this event.-
3562-
3563 \since 4.8-
3564*/-
3565bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const-
3566{-
3567 file.setFileName(f);-
3568 return file.open(flags);
never executed: return file.open(flags);
0
3569}-
3570-
3571#ifndef QT_NO_TOOLBAR-
3572/*!-
3573 \internal-
3574 \class QToolBarChangeEvent-
3575 \brief The QToolBarChangeEvent class provides an event that is-
3576 sent whenever a the toolbar button is clicked on \macos.-
3577-
3578 \ingroup events-
3579 \inmodule QtGui-
3580-
3581 The QToolBarChangeEvent is sent when the toolbar button is clicked. On-
3582 \macos, this is the long oblong button on the right side of the window-
3583 title bar. The default implementation is to toggle the appearance (hidden or-
3584 shown) of the associated toolbars for the window.-
3585*/-
3586-
3587/*!-
3588 \internal-
3589-
3590 Construct a QToolBarChangeEvent given the current button state in \a state.-
3591*/-
3592QToolBarChangeEvent::QToolBarChangeEvent(bool t)-
3593 : QEvent(ToolBarChange), tog(t)-
3594{}
never executed: end of block
0
3595-
3596/*! \internal-
3597*/-
3598QToolBarChangeEvent::~QToolBarChangeEvent()-
3599{-
3600}-
3601-
3602/*!-
3603 \fn bool QToolBarChangeEvent::toggle() const-
3604 \internal-
3605*/-
3606-
3607/*-
3608 \fn Qt::ButtonState QToolBarChangeEvent::state() const-
3609-
3610 Returns the keyboard modifier flags at the time of the event.-
3611-
3612 The returned value is a selection of the following values,-
3613 combined using the OR operator:-
3614 Qt::ShiftButton, Qt::ControlButton, Qt::MetaButton, and Qt::AltButton.-
3615*/-
3616-
3617#endif // QT_NO_TOOLBAR-
3618-
3619#ifndef QT_NO_SHORTCUT-
3620-
3621/*!-
3622 Constructs a shortcut event for the given \a key press,-
3623 associated with the QShortcut ID \a id.-
3624-
3625 \a ambiguous specifies whether there is more than one QShortcut-
3626 for the same key sequence.-
3627*/-
3628QShortcutEvent::QShortcutEvent(const QKeySequence &key, int id, bool ambiguous)-
3629 : QEvent(Shortcut), sequence(key), ambig(ambiguous), sid(id)-
3630{-
3631}
never executed: end of block
0
3632-
3633/*!-
3634 Destroys the event object.-
3635*/-
3636QShortcutEvent::~QShortcutEvent()-
3637{-
3638}-
3639-
3640#endif // QT_NO_SHORTCUT-
3641-
3642#ifndef QT_NO_DEBUG_STREAM-
3643-
3644static inline void formatTouchEvent(QDebug d, const QTouchEvent &t)-
3645{-
3646 d << "QTouchEvent(";-
3647 QtDebugUtils::formatQEnum(d, t.type());-
3648 d << " device: " << t.device()->name();-
3649 d << " states: ";-
3650 QtDebugUtils::formatQFlags(d, t.touchPointStates());-
3651 d << ", " << t.touchPoints().size() << " points: " << t.touchPoints() << ')';-
3652}
never executed: end of block
0
3653-
3654static void formatUnicodeString(QDebug d, const QString &s)-
3655{-
3656 d << '"' << hex;-
3657 for (int i = 0; i < s.size(); ++i) {
i < s.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
3658 if (i)
iDescription
TRUEnever evaluated
FALSEnever evaluated
0
3659 d << ',';
never executed: d << ',';
0
3660 d << "U+" << s.at(i).unicode();-
3661 }
never executed: end of block
0
3662 d << dec << '"';-
3663}
never executed: end of block
0
3664-
3665static inline void formatInputMethodEvent(QDebug d, const QInputMethodEvent *e)-
3666{-
3667 d << "QInputMethodEvent(";-
3668 if (!e->preeditString().isEmpty()) {
!e->preeditString().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
3669 d << "preedit=";-
3670 formatUnicodeString(d, e->preeditString());-
3671 }
never executed: end of block
0
3672 if (!e->commitString().isEmpty()) {
!e->commitString().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
3673 d << ", commit=";-
3674 formatUnicodeString(d, e->commitString());-
3675 }
never executed: end of block
0
3676 if (e->replacementLength()) {
e->replacementLength()Description
TRUEnever evaluated
FALSEnever evaluated
0
3677 d << ", replacementStart=" << e->replacementStart() << ", replacementLength="-
3678 << e->replacementLength();-
3679 }
never executed: end of block
0
3680 if (const int attributeCount = e->attributes().size()) {
const int attr...butes().size()Description
TRUEnever evaluated
FALSEnever evaluated
0
3681 d << ", attributes= {";-
3682 for (int a = 0; a < attributeCount; ++a) {
a < attributeCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
3683 const QInputMethodEvent::Attribute &at = e->attributes().at(a);-
3684 if (a)
aDescription
TRUEnever evaluated
FALSEnever evaluated
0
3685 d << ',';
never executed: d << ',';
0
3686 d << "[type= " << at.type << ", start=" << at.start << ", length=" << at.length-
3687 << ", value=" << at.value << ']';-
3688 }
never executed: end of block
0
3689 d << '}';-
3690 }
never executed: end of block
0
3691 d << ')';-
3692}
never executed: end of block
0
3693-
3694static inline void formatInputMethodQueryEvent(QDebug d, const QInputMethodQueryEvent *e)-
3695{-
3696 const Qt::InputMethodQueries queries = e->queries();-
3697 d << "QInputMethodQueryEvent(queries=" << showbase << hex << int(queries)-
3698 << noshowbase << dec << ", {";-
3699 for (unsigned mask = 1; mask <= Qt::ImTextAfterCursor; mask<<=1) {
mask <= Qt::ImTextAfterCursorDescription
TRUEnever evaluated
FALSEnever evaluated
0
3700 if (queries & mask) {
queries & maskDescription
TRUEnever evaluated
FALSEnever evaluated
0
3701 const QVariant value = e->value(static_cast<Qt::InputMethodQuery>(mask));-
3702 if (value.isValid())
value.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
3703 d << '[' << showbase << hex << mask << noshowbase << dec << '=' << value << "],";
never executed: d << '[' << showbase << hex << mask << noshowbase << dec << '=' << value << "],";
0
3704 }
never executed: end of block
0
3705 }
never executed: end of block
0
3706 d << "})";-
3707}
never executed: end of block
0
3708-
3709static const char *eventClassName(QEvent::Type t)-
3710{-
3711 switch (t) {-
3712 case QEvent::ActionAdded:
never executed: case QEvent::ActionAdded:
0
3713 case QEvent::ActionRemoved:
never executed: case QEvent::ActionRemoved:
0
3714 case QEvent::ActionChanged:
never executed: case QEvent::ActionChanged:
0
3715 return "QActionEvent";
never executed: return "QActionEvent";
0
3716 case QEvent::MouseButtonPress:
never executed: case QEvent::MouseButtonPress:
0
3717 case QEvent::MouseButtonRelease:
never executed: case QEvent::MouseButtonRelease:
0
3718 case QEvent::MouseButtonDblClick:
never executed: case QEvent::MouseButtonDblClick:
0
3719 case QEvent::MouseMove:
never executed: case QEvent::MouseMove:
0
3720 case QEvent::NonClientAreaMouseMove:
never executed: case QEvent::NonClientAreaMouseMove:
0
3721 case QEvent::NonClientAreaMouseButtonPress:
never executed: case QEvent::NonClientAreaMouseButtonPress:
0
3722 case QEvent::NonClientAreaMouseButtonRelease:
never executed: case QEvent::NonClientAreaMouseButtonRelease:
0
3723 case QEvent::NonClientAreaMouseButtonDblClick:
never executed: case QEvent::NonClientAreaMouseButtonDblClick:
0
3724 return "QMouseEvent";
never executed: return "QMouseEvent";
0
3725 case QEvent::DragEnter:
never executed: case QEvent::DragEnter:
0
3726 return "QDragEnterEvent";
never executed: return "QDragEnterEvent";
0
3727 case QEvent::DragMove:
never executed: case QEvent::DragMove:
0
3728 return "QDragMoveEvent";
never executed: return "QDragMoveEvent";
0
3729 case QEvent::Drop:
never executed: case QEvent::Drop:
0
3730 return "QDropEvent";
never executed: return "QDropEvent";
0
3731 case QEvent::KeyPress:
never executed: case QEvent::KeyPress:
0
3732 case QEvent::KeyRelease:
never executed: case QEvent::KeyRelease:
0
3733 case QEvent::ShortcutOverride:
never executed: case QEvent::ShortcutOverride:
0
3734 return "QKeyEvent";
never executed: return "QKeyEvent";
0
3735 case QEvent::FocusIn:
never executed: case QEvent::FocusIn:
0
3736 case QEvent::FocusOut:
never executed: case QEvent::FocusOut:
0
3737 case QEvent::FocusAboutToChange:
never executed: case QEvent::FocusAboutToChange:
0
3738 return "QFocusEvent";
never executed: return "QFocusEvent";
0
3739 case QEvent::ChildAdded:
never executed: case QEvent::ChildAdded:
0
3740 case QEvent::ChildPolished:
never executed: case QEvent::ChildPolished:
0
3741 case QEvent::ChildRemoved:
never executed: case QEvent::ChildRemoved:
0
3742 return "QChildEvent";
never executed: return "QChildEvent";
0
3743 case QEvent::Paint:
never executed: case QEvent::Paint:
0
3744 return "QPaintEvent";
never executed: return "QPaintEvent";
0
3745 case QEvent::Move:
never executed: case QEvent::Move:
0
3746 return "QMoveEvent";
never executed: return "QMoveEvent";
0
3747 case QEvent::Resize:
never executed: case QEvent::Resize:
0
3748 return "QResizeEvent";
never executed: return "QResizeEvent";
0
3749 case QEvent::Show:
never executed: case QEvent::Show:
0
3750 return "QShowEvent";
never executed: return "QShowEvent";
0
3751 case QEvent::Hide:
never executed: case QEvent::Hide:
0
3752 return "QHideEvent";
never executed: return "QHideEvent";
0
3753 case QEvent::Enter:
never executed: case QEvent::Enter:
0
3754 return "QEnterEvent";
never executed: return "QEnterEvent";
0
3755 case QEvent::Close:
never executed: case QEvent::Close:
0
3756 return "QCloseEvent";
never executed: return "QCloseEvent";
0
3757 case QEvent::FileOpen:
never executed: case QEvent::FileOpen:
0
3758 return "QFileOpenEvent";
never executed: return "QFileOpenEvent";
0
3759#ifndef QT_NO_GESTURES-
3760 case QEvent::NativeGesture:
never executed: case QEvent::NativeGesture:
0
3761 return "QNativeGestureEvent";
never executed: return "QNativeGestureEvent";
0
3762 case QEvent::Gesture:
never executed: case QEvent::Gesture:
0
3763 case QEvent::GestureOverride:
never executed: case QEvent::GestureOverride:
0
3764 return "QGestureEvent";
never executed: return "QGestureEvent";
0
3765#endif-
3766 case QEvent::HoverEnter:
never executed: case QEvent::HoverEnter:
0
3767 case QEvent::HoverLeave:
never executed: case QEvent::HoverLeave:
0
3768 case QEvent::HoverMove:
never executed: case QEvent::HoverMove:
0
3769 return "QHoverEvent";
never executed: return "QHoverEvent";
0
3770 case QEvent::TabletEnterProximity:
never executed: case QEvent::TabletEnterProximity:
0
3771 case QEvent::TabletLeaveProximity:
never executed: case QEvent::TabletLeaveProximity:
0
3772 case QEvent::TabletPress:
never executed: case QEvent::TabletPress:
0
3773 case QEvent::TabletMove:
never executed: case QEvent::TabletMove:
0
3774 case QEvent::TabletRelease:
never executed: case QEvent::TabletRelease:
0
3775 return "QTabletEvent";
never executed: return "QTabletEvent";
0
3776 case QEvent::StatusTip:
never executed: case QEvent::StatusTip:
0
3777 return "QStatusTipEvent";
never executed: return "QStatusTipEvent";
0
3778 case QEvent::ToolTip:
never executed: case QEvent::ToolTip:
0
3779 return "QHelpEvent";
never executed: return "QHelpEvent";
0
3780 case QEvent::WindowStateChange:
never executed: case QEvent::WindowStateChange:
0
3781 return "QWindowStateChangeEvent";
never executed: return "QWindowStateChangeEvent";
0
3782 case QEvent::Wheel:
never executed: case QEvent::Wheel:
0
3783 return "QWheelEvent";
never executed: return "QWheelEvent";
0
3784 case QEvent::TouchBegin:
never executed: case QEvent::TouchBegin:
0
3785 case QEvent::TouchUpdate:
never executed: case QEvent::TouchUpdate:
0
3786 case QEvent::TouchEnd:
never executed: case QEvent::TouchEnd:
0
3787 return "QTouchEvent";
never executed: return "QTouchEvent";
0
3788 case QEvent::Shortcut:
never executed: case QEvent::Shortcut:
0
3789 return "QShortcutEvent";
never executed: return "QShortcutEvent";
0
3790 case QEvent::InputMethod:
never executed: case QEvent::InputMethod:
0
3791 return "QInputMethodEvent";
never executed: return "QInputMethodEvent";
0
3792 case QEvent::InputMethodQuery:
never executed: case QEvent::InputMethodQuery:
0
3793 return "QInputMethodQueryEvent";
never executed: return "QInputMethodQueryEvent";
0
3794 case QEvent::OrientationChange:
never executed: case QEvent::OrientationChange:
0
3795 return "QScreenOrientationChangeEvent";
never executed: return "QScreenOrientationChangeEvent";
0
3796 case QEvent::ScrollPrepare:
never executed: case QEvent::ScrollPrepare:
0
3797 return "QScrollPrepareEvent";
never executed: return "QScrollPrepareEvent";
0
3798 case QEvent::Scroll:
never executed: case QEvent::Scroll:
0
3799 return "QScrollEvent";
never executed: return "QScrollEvent";
0
3800 case QEvent::GraphicsSceneMouseMove:
never executed: case QEvent::GraphicsSceneMouseMove:
0
3801 case QEvent::GraphicsSceneMousePress:
never executed: case QEvent::GraphicsSceneMousePress:
0
3802 case QEvent::GraphicsSceneMouseRelease:
never executed: case QEvent::GraphicsSceneMouseRelease:
0
3803 case QEvent::GraphicsSceneMouseDoubleClick:
never executed: case QEvent::GraphicsSceneMouseDoubleClick:
0
3804 return "QGraphicsSceneMouseEvent";
never executed: return "QGraphicsSceneMouseEvent";
0
3805 case QEvent::GraphicsSceneContextMenu:
never executed: case QEvent::GraphicsSceneContextMenu:
0
3806 case QEvent::GraphicsSceneHoverEnter:
never executed: case QEvent::GraphicsSceneHoverEnter:
0
3807 case QEvent::GraphicsSceneHoverMove:
never executed: case QEvent::GraphicsSceneHoverMove:
0
3808 case QEvent::GraphicsSceneHoverLeave:
never executed: case QEvent::GraphicsSceneHoverLeave:
0
3809 case QEvent::GraphicsSceneHelp:
never executed: case QEvent::GraphicsSceneHelp:
0
3810 case QEvent::GraphicsSceneDragEnter:
never executed: case QEvent::GraphicsSceneDragEnter:
0
3811 case QEvent::GraphicsSceneDragMove:
never executed: case QEvent::GraphicsSceneDragMove:
0
3812 case QEvent::GraphicsSceneDragLeave:
never executed: case QEvent::GraphicsSceneDragLeave:
0
3813 case QEvent::GraphicsSceneDrop:
never executed: case QEvent::GraphicsSceneDrop:
0
3814 case QEvent::GraphicsSceneWheel:
never executed: case QEvent::GraphicsSceneWheel:
0
3815 return "QGraphicsSceneEvent";
never executed: return "QGraphicsSceneEvent";
0
3816 case QEvent::Timer:
never executed: case QEvent::Timer:
0
3817 return "QTimerEvent";
never executed: return "QTimerEvent";
0
3818 case QEvent::PlatformSurface:
never executed: case QEvent::PlatformSurface:
0
3819 return "QPlatformSurfaceEvent";
never executed: return "QPlatformSurfaceEvent";
0
3820 default:
never executed: default:
0
3821 break;
never executed: break;
0
3822 }-
3823 return "QEvent";
never executed: return "QEvent";
0
3824}-
3825-
3826# ifndef QT_NO_DRAGANDDROP-
3827-
3828static void formatDropEvent(QDebug d, const QDropEvent *e)-
3829{-
3830 const QEvent::Type type = e->type();-
3831 d << eventClassName(type) << "(dropAction=";-
3832 QtDebugUtils::formatQEnum(d, e->dropAction());-
3833 d << ", proposedAction=";-
3834 QtDebugUtils::formatQEnum(d, e->proposedAction());-
3835 d << ", possibleActions=";-
3836 QtDebugUtils::formatQFlags(d, e->possibleActions());-
3837 d << ", posF=";-
3838 QtDebugUtils::formatQPoint(d, e->posF());-
3839 if (type == QEvent::DragMove || type == QEvent::DragEnter)
type == QEvent::DragMoveDescription
TRUEnever evaluated
FALSEnever evaluated
type == QEvent::DragEnterDescription
TRUEnever evaluated
FALSEnever evaluated
0
3840 d << ", answerRect=" << static_cast<const QDragMoveEvent *>(e)->answerRect();
never executed: d << ", answerRect=" << static_cast<const QDragMoveEvent *>(e)->answerRect();
0
3841 d << ", formats=" << e->mimeData()->formats();-
3842 QtDebugUtils::formatNonNullQFlags(d, ", keyboardModifiers=", e->keyboardModifiers());-
3843 d << ", ";-
3844 QtDebugUtils::formatQFlags(d, e->mouseButtons());-
3845}
never executed: end of block
0
3846-
3847# endif // !QT_NO_DRAGANDDROP-
3848-
3849# ifndef QT_NO_TABLETEVENT-
3850-
3851static void formatTabletEvent(QDebug d, const QTabletEvent *e)-
3852{-
3853 const QEvent::Type type = e->type();-
3854-
3855 d << eventClassName(type) << '(';-
3856 QtDebugUtils::formatQEnum(d, type);-
3857 d << ", device=";-
3858 QtDebugUtils::formatQEnum(d, e->device());-
3859 d << ", pointerType=";-
3860 QtDebugUtils::formatQEnum(d, e->pointerType());-
3861 d << ", uniqueId=" << e->uniqueId()-
3862 << ", pos=" << e->posF()-
3863 << ", z=" << e->z()-
3864 << ", xTilt=" << e->xTilt()-
3865 << ", yTilt=" << e->yTilt()-
3866 << ", ";-
3867 QtDebugUtils::formatQFlags(d, e->buttons());-
3868 if (type == QEvent::TabletPress || type == QEvent::TabletMove)
type == QEvent::TabletPressDescription
TRUEnever evaluated
FALSEnever evaluated
type == QEvent::TabletMoveDescription
TRUEnever evaluated
FALSEnever evaluated
0
3869 d << ", pressure=" << e->pressure();
never executed: d << ", pressure=" << e->pressure();
0
3870 if (e->device() == QTabletEvent::RotationStylus || e->device() == QTabletEvent::FourDMouse)
e->device() ==...RotationStylusDescription
TRUEnever evaluated
FALSEnever evaluated
e->device() ==...nt::FourDMouseDescription
TRUEnever evaluated
FALSEnever evaluated
0
3871 d << ", rotation=" << e->rotation();
never executed: d << ", rotation=" << e->rotation();
0
3872 if (e->device() == QTabletEvent::Airbrush)
e->device() ==...vent::AirbrushDescription
TRUEnever evaluated
FALSEnever evaluated
0
3873 d << ", tangentialPressure=" << e->tangentialPressure();
never executed: d << ", tangentialPressure=" << e->tangentialPressure();
0
3874}
never executed: end of block
0
3875-
3876# endif // !QT_NO_TABLETEVENT-
3877-
3878QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &tp)-
3879{-
3880 QDebugStateSaver saver(dbg);-
3881 dbg.nospace();-
3882 dbg << "TouchPoint(" << tp.id() << " (";-
3883 QtDebugUtils::formatQRect(dbg, tp.rect());-
3884 dbg << ") ";-
3885 QtDebugUtils::formatQEnum(dbg, tp.state());-
3886 dbg << " press " << tp.pressure() << " vel " << tp.velocity()-
3887 << " start (";-
3888 QtDebugUtils::formatQPoint(dbg, tp.startPos());-
3889 dbg << ") last (";-
3890 QtDebugUtils::formatQPoint(dbg, tp.lastPos());-
3891 dbg << ") delta (";-
3892 QtDebugUtils::formatQPoint(dbg, tp.pos() - tp.lastPos());-
3893 dbg << ')';-
3894 return dbg;
never executed: return dbg;
0
3895}-
3896-
3897QDebug operator<<(QDebug dbg, const QEvent *e)-
3898{-
3899 QDebugStateSaver saver(dbg);-
3900 dbg.nospace();-
3901 if (!e) {
!eDescription
TRUEnever evaluated
FALSEnever evaluated
0
3902 dbg << "QEvent(this = 0x0)";-
3903 return dbg;
never executed: return dbg;
0
3904 }-
3905 // More useful event output could be added here-
3906 const QEvent::Type type = e->type();-
3907 switch (type) {-
3908 case QEvent::Expose:
never executed: case QEvent::Expose:
0
3909 dbg << "QExposeEvent(" << static_cast<const QExposeEvent *>(e)->region() << ')';-
3910 break;
never executed: break;
0
3911 case QEvent::Paint:
never executed: case QEvent::Paint:
0
3912 dbg << "QPaintEvent(" << static_cast<const QPaintEvent *>(e)->region() << ')';-
3913 break;
never executed: break;
0
3914 case QEvent::MouseButtonPress:
never executed: case QEvent::MouseButtonPress:
0
3915 case QEvent::MouseMove:
never executed: case QEvent::MouseMove:
0
3916 case QEvent::MouseButtonRelease:
never executed: case QEvent::MouseButtonRelease:
0
3917 case QEvent::MouseButtonDblClick:
never executed: case QEvent::MouseButtonDblClick:
0
3918 case QEvent::NonClientAreaMouseButtonPress:
never executed: case QEvent::NonClientAreaMouseButtonPress:
0
3919 case QEvent::NonClientAreaMouseMove:
never executed: case QEvent::NonClientAreaMouseMove:
0
3920 case QEvent::NonClientAreaMouseButtonRelease:
never executed: case QEvent::NonClientAreaMouseButtonRelease:
0
3921 case QEvent::NonClientAreaMouseButtonDblClick:
never executed: case QEvent::NonClientAreaMouseButtonDblClick:
0
3922 {-
3923 const QMouseEvent *me = static_cast<const QMouseEvent*>(e);-
3924 const Qt::MouseButton button = me->button();-
3925 const Qt::MouseButtons buttons = me->buttons();-
3926 dbg << "QMouseEvent(";-
3927 QtDebugUtils::formatQEnum(dbg, type);-
3928 if (type != QEvent::MouseMove && type != QEvent::NonClientAreaMouseMove) {
type != QEvent::MouseMoveDescription
TRUEnever evaluated
FALSEnever evaluated
type != QEvent...tAreaMouseMoveDescription
TRUEnever evaluated
FALSEnever evaluated
0
3929 dbg << ", ";-
3930 QtDebugUtils::formatQEnum(dbg, button);-
3931 }
never executed: end of block
0
3932 if (buttons && button != buttons) {
buttonsDescription
TRUEnever evaluated
FALSEnever evaluated
button != buttonsDescription
TRUEnever evaluated
FALSEnever evaluated
0
3933 dbg << ", buttons=";-
3934 QtDebugUtils::formatQFlags(dbg, buttons);-
3935 }
never executed: end of block
0
3936 QtDebugUtils::formatNonNullQFlags(dbg, ", ", me->modifiers());-
3937 dbg << ", localPos=";-
3938 QtDebugUtils::formatQPoint(dbg, me->localPos());-
3939 dbg << ", screenPos=";-
3940 QtDebugUtils::formatQPoint(dbg, me->screenPos());-
3941 QtDebugUtils::formatNonNullQEnum(dbg, ", ", me->source());-
3942 QtDebugUtils::formatNonNullQFlags(dbg, ", flags=", me->flags());-
3943 dbg << ')';-
3944 }-
3945 break;
never executed: break;
0
3946# ifndef QT_NO_WHEELEVENT-
3947 case QEvent::Wheel: {
never executed: case QEvent::Wheel:
0
3948 const QWheelEvent *we = static_cast<const QWheelEvent *>(e);-
3949 dbg << "QWheelEvent(" << "pixelDelta=" << we->pixelDelta() << ", angleDelta=" << we->angleDelta() << ')';-
3950 }-
3951 break;
never executed: break;
0
3952# endif // !QT_NO_WHEELEVENT-
3953 case QEvent::KeyPress:
never executed: case QEvent::KeyPress:
0
3954 case QEvent::KeyRelease:
never executed: case QEvent::KeyRelease:
0
3955 case QEvent::ShortcutOverride:
never executed: case QEvent::ShortcutOverride:
0
3956 {-
3957 const QKeyEvent *ke = static_cast<const QKeyEvent *>(e);-
3958 dbg << "QKeyEvent(";-
3959 QtDebugUtils::formatQEnum(dbg, type);-
3960 dbg << ", ";-
3961 QtDebugUtils::formatQEnum(dbg, static_cast<Qt::Key>(ke->key()));-
3962 QtDebugUtils::formatNonNullQFlags(dbg, ", ", ke->modifiers());-
3963 if (!ke->text().isEmpty())
!ke->text().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
3964 dbg << ", text=" << ke->text();
never executed: dbg << ", text=" << ke->text();
0
3965 if (ke->isAutoRepeat())
ke->isAutoRepeat()Description
TRUEnever evaluated
FALSEnever evaluated
0
3966 dbg << ", autorepeat, count=" << ke->count();
never executed: dbg << ", autorepeat, count=" << ke->count();
0
3967 dbg << ')';-
3968 }-
3969 break;
never executed: break;
0
3970 case QEvent::Shortcut: {
never executed: case QEvent::Shortcut:
0
3971 const QShortcutEvent *se = static_cast<const QShortcutEvent *>(e);-
3972 dbg << "QShortcutEvent(" << se->key().toString() << ", id=" << se->shortcutId();-
3973 if (se->isAmbiguous())
se->isAmbiguous()Description
TRUEnever evaluated
FALSEnever evaluated
0
3974 dbg << ", ambiguous";
never executed: dbg << ", ambiguous";
0
3975 dbg << ')';-
3976 }-
3977 break;
never executed: break;
0
3978 case QEvent::FocusAboutToChange:
never executed: case QEvent::FocusAboutToChange:
0
3979 case QEvent::FocusIn:
never executed: case QEvent::FocusIn:
0
3980 case QEvent::FocusOut:
never executed: case QEvent::FocusOut:
0
3981 dbg << "QFocusEvent(";-
3982 QtDebugUtils::formatQEnum(dbg, type);-
3983 dbg << ", ";-
3984 QtDebugUtils::formatQEnum(dbg, static_cast<const QFocusEvent *>(e)->reason());-
3985 dbg << ')';-
3986 break;
never executed: break;
0
3987 case QEvent::Move: {
never executed: case QEvent::Move:
0
3988 const QMoveEvent *me = static_cast<const QMoveEvent *>(e);-
3989 dbg << "QMoveEvent(";-
3990 QtDebugUtils::formatQPoint(dbg, me->pos());-
3991 if (!me->spontaneous())
!me->spontaneous()Description
TRUEnever evaluated
FALSEnever evaluated
0
3992 dbg << ", non-spontaneous";
never executed: dbg << ", non-spontaneous";
0
3993 dbg << ')';-
3994 }-
3995 break;
never executed: break;
0
3996 case QEvent::Resize: {
never executed: case QEvent::Resize:
0
3997 const QResizeEvent *re = static_cast<const QResizeEvent *>(e);-
3998 dbg << "QResizeEvent(";-
3999 QtDebugUtils::formatQSize(dbg, re->size());-
4000 if (!re->spontaneous())
!re->spontaneous()Description
TRUEnever evaluated
FALSEnever evaluated
0
4001 dbg << ", non-spontaneous";
never executed: dbg << ", non-spontaneous";
0
4002 dbg << ')';-
4003 }-
4004 break;
never executed: break;
0
4005# ifndef QT_NO_DRAGANDDROP-
4006 case QEvent::DragEnter:
never executed: case QEvent::DragEnter:
0
4007 case QEvent::DragMove:
never executed: case QEvent::DragMove:
0
4008 case QEvent::Drop:
never executed: case QEvent::Drop:
0
4009 formatDropEvent(dbg, static_cast<const QDropEvent *>(e));-
4010 break;
never executed: break;
0
4011# endif // !QT_NO_DRAGANDDROP-
4012 case QEvent::InputMethod:
never executed: case QEvent::InputMethod:
0
4013 formatInputMethodEvent(dbg, static_cast<const QInputMethodEvent *>(e));-
4014 break;
never executed: break;
0
4015 case QEvent::InputMethodQuery:
never executed: case QEvent::InputMethodQuery:
0
4016 formatInputMethodQueryEvent(dbg, static_cast<const QInputMethodQueryEvent *>(e));-
4017 break;
never executed: break;
0
4018 case QEvent::TouchBegin:
never executed: case QEvent::TouchBegin:
0
4019 case QEvent::TouchUpdate:
never executed: case QEvent::TouchUpdate:
0
4020 case QEvent::TouchEnd:
never executed: case QEvent::TouchEnd:
0
4021 formatTouchEvent(dbg, *static_cast<const QTouchEvent*>(e));-
4022 break;
never executed: break;
0
4023 case QEvent::ChildAdded:
never executed: case QEvent::ChildAdded:
0
4024 case QEvent::ChildPolished:
never executed: case QEvent::ChildPolished:
0
4025 case QEvent::ChildRemoved:
never executed: case QEvent::ChildRemoved:
0
4026 dbg << "QChildEvent(";-
4027 QtDebugUtils::formatQEnum(dbg, type);-
4028 dbg << ", " << (static_cast<const QChildEvent*>(e))->child() << ')';-
4029 break;
never executed: break;
0
4030# ifndef QT_NO_GESTURES-
4031 case QEvent::NativeGesture: {
never executed: case QEvent::NativeGesture:
0
4032 const QNativeGestureEvent *ne = static_cast<const QNativeGestureEvent *>(e);-
4033 dbg << "QNativeGestureEvent(";-
4034 QtDebugUtils::formatQEnum(dbg, ne->gestureType());-
4035 dbg << "localPos=";-
4036 QtDebugUtils::formatQPoint(dbg, ne->localPos());-
4037 dbg << ", value=" << ne->value() << ')';-
4038 }-
4039 break;
never executed: break;
0
4040# endif // !QT_NO_GESTURES-
4041 case QEvent::ApplicationStateChange:
never executed: case QEvent::ApplicationStateChange:
0
4042 dbg << "QApplicationStateChangeEvent(";-
4043 QtDebugUtils::formatQEnum(dbg, static_cast<const QApplicationStateChangeEvent *>(e)->applicationState());-
4044 dbg << ')';-
4045 break;
never executed: break;
0
4046# ifndef QT_NO_CONTEXTMENU-
4047 case QEvent::ContextMenu:
never executed: case QEvent::ContextMenu:
0
4048 dbg << "QContextMenuEvent(" << static_cast<const QContextMenuEvent *>(e)->pos() << ')';-
4049 break;
never executed: break;
0
4050# endif // !QT_NO_CONTEXTMENU-
4051# ifndef QT_NO_TABLETEVENT-
4052 case QEvent::TabletEnterProximity:
never executed: case QEvent::TabletEnterProximity:
0
4053 case QEvent::TabletLeaveProximity:
never executed: case QEvent::TabletLeaveProximity:
0
4054 case QEvent::TabletPress:
never executed: case QEvent::TabletPress:
0
4055 case QEvent::TabletMove:
never executed: case QEvent::TabletMove:
0
4056 case QEvent::TabletRelease:
never executed: case QEvent::TabletRelease:
0
4057 formatTabletEvent(dbg, static_cast<const QTabletEvent *>(e));-
4058 break;
never executed: break;
0
4059# endif // !QT_NO_TABLETEVENT-
4060 case QEvent::Enter:
never executed: case QEvent::Enter:
0
4061 dbg << "QEnterEvent(" << static_cast<const QEnterEvent *>(e)->pos() << ')';-
4062 break;
never executed: break;
0
4063 case QEvent::Timer:
never executed: case QEvent::Timer:
0
4064 dbg << "QTimerEvent(id=" << static_cast<const QTimerEvent *>(e)->timerId() << ')';-
4065 break;
never executed: break;
0
4066 case QEvent::PlatformSurface:
never executed: case QEvent::PlatformSurface:
0
4067 dbg << "QPlatformSurfaceEvent(surfaceEventType=";-
4068 switch (static_cast<const QPlatformSurfaceEvent *>(e)->surfaceEventType()) {-
4069 case QPlatformSurfaceEvent::SurfaceCreated:
never executed: case QPlatformSurfaceEvent::SurfaceCreated:
0
4070 dbg << "SurfaceCreated";-
4071 break;
never executed: break;
0
4072 case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed:
never executed: case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed:
0
4073 dbg << "SurfaceAboutToBeDestroyed";-
4074 break;
never executed: break;
0
4075 }-
4076 dbg << ')';-
4077 break;
never executed: break;
0
4078 default:
never executed: default:
0
4079 dbg << eventClassName(type) << '(';-
4080 QtDebugUtils::formatQEnum(dbg, type);-
4081 dbg << ", " << (const void *)e << ')';-
4082 break;
never executed: break;
0
4083 }-
4084 return dbg;
never executed: return dbg;
0
4085}-
4086#endif // !QT_NO_DEBUG_STREAM-
4087-
4088/*!-
4089 \class QShortcutEvent-
4090 \brief The QShortcutEvent class provides an event which is generated when-
4091 the user presses a key combination.-
4092-
4093 \ingroup events-
4094 \inmodule QtGui-
4095-
4096 Normally you do not need to use this class directly; QShortcut-
4097 provides a higher-level interface to handle shortcut keys.-
4098-
4099 \sa QShortcut-
4100*/-
4101-
4102/*!-
4103 \fn const QKeySequence &QShortcutEvent::key() const-
4104-
4105 Returns the key sequence that triggered the event.-
4106*/-
4107-
4108/*!-
4109 \fn int QShortcutEvent::shortcutId() const-
4110-
4111 Returns the ID of the QShortcut object for which this event was-
4112 generated.-
4113-
4114 \sa QShortcut::id()-
4115*/-
4116-
4117/*!-
4118 \fn bool QShortcutEvent::isAmbiguous() const-
4119-
4120 Returns \c true if the key sequence that triggered the event is-
4121 ambiguous.-
4122-
4123 \sa QShortcut::activatedAmbiguously()-
4124*/-
4125-
4126/*!-
4127 \class QWindowStateChangeEvent-
4128 \ingroup events-
4129 \inmodule QtGui-
4130-
4131 \brief The QWindowStateChangeEvent class provides the window state before a-
4132 window state change.-
4133*/-
4134-
4135/*! \fn Qt::WindowStates QWindowStateChangeEvent::oldState() const-
4136-
4137 Returns the state of the window before the change.-
4138*/-
4139-
4140/*! \internal-
4141 */-
4142QWindowStateChangeEvent::QWindowStateChangeEvent(Qt::WindowStates s, bool isOverride)-
4143 : QEvent(WindowStateChange), ostate(s), m_override(isOverride)-
4144{-
4145}
never executed: end of block
0
4146-
4147/*! \internal-
4148 */-
4149bool QWindowStateChangeEvent::isOverride() const-
4150{-
4151 return m_override;
never executed: return m_override;
0
4152}-
4153-
4154/*! \internal-
4155*/-
4156QWindowStateChangeEvent::~QWindowStateChangeEvent()-
4157{-
4158}-
4159-
4160-
4161/*!-
4162 \class QTouchEvent-
4163 \brief The QTouchEvent class contains parameters that describe a touch event.-
4164 \since 4.6-
4165 \ingroup events-
4166 \ingroup touch-
4167 \inmodule QtGui-
4168-
4169 \section1 Enabling Touch Events-
4170-
4171 Touch events occur when pressing, releasing, or moving one or more touch points on a touch-
4172 device (such as a touch-screen or track-pad). To receive touch events, widgets have to have the-
4173 Qt::WA_AcceptTouchEvents attribute set and graphics items need to have the-
4174 \l{QGraphicsItem::setAcceptTouchEvents()}{acceptTouchEvents} attribute set to true.-
4175-
4176 When using QAbstractScrollArea based widgets, you should enable the Qt::WA_AcceptTouchEvents-
4177 attribute on the scroll area's \l{QAbstractScrollArea::viewport()}{viewport}.-
4178-
4179 Similarly to QMouseEvent, Qt automatically grabs each touch point on the first press inside a-
4180 widget, and the widget will receive all updates for the touch point until it is released.-
4181 Note that it is possible for a widget to receive events for numerous touch points, and that-
4182 multiple widgets may be receiving touch events at the same time.-
4183-
4184 \section1 Event Handling-
4185-
4186 All touch events are of type QEvent::TouchBegin, QEvent::TouchUpdate, QEvent::TouchEnd or-
4187 QEvent::TouchCancel. Reimplement QWidget::event() or QAbstractScrollArea::viewportEvent() for-
4188 widgets and QGraphicsItem::sceneEvent() for items in a graphics view to receive touch events.-
4189-
4190 Unlike widgets, QWindows receive touch events always, there is no need to opt in. When working-
4191 directly with a QWindow, it is enough to reimplement QWindow::touchEvent().-
4192-
4193 The QEvent::TouchUpdate and QEvent::TouchEnd events are sent to the widget or item that-
4194 accepted the QEvent::TouchBegin event. If the QEvent::TouchBegin event is not accepted and not-
4195 filtered by an event filter, then no further touch events are sent until the next-
4196 QEvent::TouchBegin.-
4197-
4198 Some systems may send an event of type QEvent::TouchCancel. Upon receiving this event-
4199 applications are requested to ignore the entire active touch sequence. For example in a-
4200 composited system the compositor may decide to treat certain gestures as system-wide-
4201 gestures. Whenever such a decision is made (the gesture is recognized), the clients will be-
4202 notified with a QEvent::TouchCancel event so they can update their state accordingly.-
4203-
4204 The touchPoints() function returns a list of all touch points contained in the event. Note that-
4205 this list may be empty, for example in case of a QEvent::TouchCancel event. Information about-
4206 each touch point can be retrieved using the QTouchEvent::TouchPoint class. The-
4207 Qt::TouchPointState enum describes the different states that a touch point may have.-
4208-
4209 \note The list of touchPoints() will never be partial: A touch event will always contain a touch-
4210 point for each existing physical touch contacts targetting the window or widget to which the-
4211 event is sent. For instance, assuming that all touches target the same window or widget, an-
4212 event with a condition of touchPoints().count()==2 is guaranteed to imply that the number of-
4213 fingers touching the touchscreen or touchpad is exactly two.-
4214-
4215 \section1 Event Delivery and Propagation-
4216-
4217 By default, QGuiApplication translates the first touch point in a QTouchEvent into-
4218 a QMouseEvent. This makes it possible to enable touch events on existing widgets that do not-
4219 normally handle QTouchEvent. See below for information on some special considerations needed-
4220 when doing this.-
4221-
4222 QEvent::TouchBegin is the first touch event sent to a widget. The QEvent::TouchBegin event-
4223 contains a special accept flag that indicates whether the receiver wants the event. By default,-
4224 the event is accepted. You should call ignore() if the touch event is not handled by your-
4225 widget. The QEvent::TouchBegin event is propagated up the parent widget chain until a widget-
4226 accepts it with accept(), or an event filter consumes it. For QGraphicsItems, the-
4227 QEvent::TouchBegin event is propagated to items under the mouse (similar to mouse event-
4228 propagation for QGraphicsItems).-
4229-
4230 \section1 Touch Point Grouping-
4231-
4232 As mentioned above, it is possible that several widgets can be receiving QTouchEvents at the-
4233 same time. However, Qt makes sure to never send duplicate QEvent::TouchBegin events to the same-
4234 widget, which could theoretically happen during propagation if, for example, the user touched 2-
4235 separate widgets in a QGroupBox and both widgets ignored the QEvent::TouchBegin event.-
4236-
4237 To avoid this, Qt will group new touch points together using the following rules:-
4238-
4239 \list-
4240-
4241 \li When the first touch point is detected, the destination widget is determined firstly by the-
4242 location on screen and secondly by the propagation rules.-
4243-
4244 \li When additional touch points are detected, Qt first looks to see if there are any active-
4245 touch points on any ancestor or descendent of the widget under the new touch point. If there-
4246 are, the new touch point is grouped with the first, and the new touch point will be sent in a-
4247 single QTouchEvent to the widget that handled the first touch point. (The widget under the new-
4248 touch point will not receive an event).-
4249-
4250 \endlist-
4251-
4252 This makes it possible for sibling widgets to handle touch events independently while making-
4253 sure that the sequence of QTouchEvents is always correct.-
4254-
4255 \section1 Mouse Events and Touch Event Synthesizing-
4256-
4257 QTouchEvent delivery is independent from that of QMouseEvent. The application flags-
4258 Qt::AA_SynthesizeTouchForUnhandledMouseEvents and Qt::AA_SynthesizeMouseForUnhandledTouchEvents-
4259 can be used to enable or disable automatic synthesizing of touch events to mouse events and-
4260 mouse events to touch events.-
4261-
4262 \section1 Caveats-
4263-
4264 \list-
4265-
4266 \li As mentioned above, enabling touch events means multiple widgets can be receiving touch-
4267 events simultaneously. Combined with the default QWidget::event() handling for QTouchEvents,-
4268 this gives you great flexibility in designing touch user interfaces. Be aware of the-
4269 implications. For example, it is possible that the user is moving a QSlider with one finger and-
4270 pressing a QPushButton with another. The signals emitted by these widgets will be-
4271 interleaved.-
4272-
4273 \li Recursion into the event loop using one of the exec() methods (e.g., QDialog::exec() or-
4274 QMenu::exec()) in a QTouchEvent event handler is not supported. Since there are multiple event-
4275 recipients, recursion may cause problems, including but not limited to lost events-
4276 and unexpected infinite recursion.-
4277-
4278 \li QTouchEvents are not affected by a \l{QWidget::grabMouse()}{mouse grab} or an-
4279 \l{QApplication::activePopupWidget()}{active pop-up widget}. The behavior of QTouchEvents is-
4280 undefined when opening a pop-up or grabbing the mouse while there are more than one active touch-
4281 points.-
4282-
4283 \endlist-
4284-
4285 \sa QTouchEvent::TouchPoint, Qt::TouchPointState, Qt::WA_AcceptTouchEvents,-
4286 QGraphicsItem::acceptTouchEvents()-
4287*/-
4288-
4289/*! \enum QTouchEvent::DeviceType-
4290 \obsolete-
4291-
4292 This enum represents the type of device that generated a QTouchEvent.-
4293-
4294 This enum has been deprecated. Use QTouchDevice::DeviceType instead.-
4295 \omitvalue TouchPad-
4296 \omitvalue TouchScreen-
4297-
4298 \sa QTouchDevice::DeviceType, QTouchDevice::type(), QTouchEvent::device()-
4299*/-
4300-
4301/*!-
4302 Constructs a QTouchEvent with the given \a eventType, \a device, and-
4303 \a touchPoints. The \a touchPointStates and \a modifiers-
4304 are the current touch point states and keyboard modifiers at the time of-
4305 the event.-
4306*/-
4307QTouchEvent::QTouchEvent(QEvent::Type eventType,-
4308 QTouchDevice *device,-
4309 Qt::KeyboardModifiers modifiers,-
4310 Qt::TouchPointStates touchPointStates,-
4311 const QList<QTouchEvent::TouchPoint> &touchPoints)-
4312 : QInputEvent(eventType, modifiers),-
4313 _window(0),-
4314 _target(0),-
4315 _device(device),-
4316 _touchPointStates(touchPointStates),-
4317 _touchPoints(touchPoints)-
4318{
never executed: end of block
}
never executed: end of block
0
4319-
4320/*!-
4321 Destroys the QTouchEvent.-
4322*/-
4323QTouchEvent::~QTouchEvent()-
4324{ }-
4325-
4326/*! \fn QWindow *QTouchEvent::window() const-
4327-
4328 Returns the window on which the event occurred. Useful for doing-
4329 global-local mapping on data like rawScreenPositions() which,-
4330 for performance reasons, only stores the global positions in the-
4331 touch event.-
4332*/-
4333-
4334/*! \fn QObject *QTouchEvent::target() const-
4335-
4336 Returns the target object within the window on which the event occurred.-
4337 This is typically a QWidget or a QQuickItem. May be 0 when no specific target is available.-
4338*/-
4339-
4340/*! \fn QTouchEvent::DeviceType QTouchEvent::deviceType() const-
4341 \obsolete-
4342-
4343 Returns the touch device Type, which is of type \l {QTouchEvent::DeviceType} {DeviceType}.-
4344-
4345 This function has been deprecated. Use QTouchDevice::type() instead.-
4346-
4347 \sa QTouchDevice::type(), QTouchEvent::device()-
4348*/-
4349-
4350/*! \fn QTouchEvent::TouchPoint::TouchPoint(TouchPoint &&other)-
4351-
4352 Move-constructs a TouchPoint instance, making it point to the same-
4353 object that \a other was pointing to.-
4354*/-
4355-
4356/*! \fn Qt::TouchPointStates QTouchEvent::touchPointStates() const-
4357-
4358 Returns a bitwise OR of all the touch point states for this event.-
4359*/-
4360-
4361/*! \fn const QList<QTouchEvent::TouchPoint> &QTouchEvent::touchPoints() const-
4362-
4363 Returns the list of touch points contained in the touch event.-
4364*/-
4365-
4366/*! \fn QTouchDevice* QTouchEvent::device() const-
4367-
4368 Returns the touch device from which this touch event originates.-
4369*/-
4370-
4371/*! \fn void QTouchEvent::setWindow(QWindow *window)-
4372-
4373 \internal-
4374-
4375 Sets the window for this event.-
4376*/-
4377-
4378/*! \fn void QTouchEvent::setTarget(QObject *target)-
4379-
4380 \internal-
4381-
4382 Sets the target within the window (typically a widget) for this event.-
4383*/-
4384-
4385/*! \fn void QTouchEvent::setTouchPointStates(Qt::TouchPointStates touchPointStates)-
4386-
4387 \internal-
4388-
4389 Sets a bitwise OR of all the touch point states for this event.-
4390*/-
4391-
4392/*! \fn void QTouchEvent::setTouchPoints(const QList<QTouchEvent::TouchPoint> &touchPoints)-
4393-
4394 \internal-
4395-
4396 Sets the list of touch points for this event.-
4397*/-
4398-
4399/*! \fn void QTouchEvent::setDevice(QTouchDevice *adevice)-
4400-
4401 \internal-
4402-
4403 Sets the device to \a adevice.-
4404*/-
4405-
4406/*! \class QTouchEvent::TouchPoint-
4407 \brief The TouchPoint class provides information about a touch point in a QTouchEvent.-
4408 \since 4.6-
4409 \inmodule QtGui-
4410*/-
4411-
4412/*! \enum TouchPoint::InfoFlag-
4413-
4414 The values of this enum describe additional information about a touch point.-
4415-
4416 \value Pen Indicates that the contact has been made by a designated pointing device (e.g. a pen) instead of a finger.-
4417*/-
4418-
4419/*!-
4420 \internal-
4421-
4422 Constructs a QTouchEvent::TouchPoint for use in a QTouchEvent.-
4423*/-
4424QTouchEvent::TouchPoint::TouchPoint(int id)-
4425 : d(new QTouchEventTouchPointPrivate(id))-
4426{
never executed: end of block
}
never executed: end of block
0
4427-
4428/*!-
4429 \fn TouchPoint::TouchPoint(const TouchPoint &other)-
4430 \internal-
4431-
4432 Constructs a copy of \a other.-
4433*/-
4434QTouchEvent::TouchPoint::TouchPoint(const QTouchEvent::TouchPoint &other)-
4435 : d(other.d)-
4436{-
4437 d->ref.ref();-
4438}
never executed: end of block
0
4439-
4440/*!-
4441 \internal-
4442-
4443 Destroys the QTouchEvent::TouchPoint.-
4444*/-
4445QTouchEvent::TouchPoint::~TouchPoint()-
4446{-
4447 if (d && !d->ref.deref())
dDescription
TRUEnever evaluated
FALSEnever evaluated
!d->ref.deref()Description
TRUEnever evaluated
FALSEnever evaluated
0
4448 delete d;
never executed: delete d;
0
4449}
never executed: end of block
0
4450-
4451/*!-
4452 Returns the id number of this touch point.-
4453-
4454 Do not assume that id numbers start at zero or that they are sequential.-
4455 Such an assumption is often false due to the way the underlying drivers work.-
4456*/-
4457int QTouchEvent::TouchPoint::id() const-
4458{-
4459 return d->id;
never executed: return d->id;
0
4460}-
4461-
4462/*!-
4463 Returns the current state of this touch point.-
4464*/-
4465Qt::TouchPointState QTouchEvent::TouchPoint::state() const-
4466{-
4467 return Qt::TouchPointState(int(d->state));
never executed: return Qt::TouchPointState(int(d->state));
0
4468}-
4469-
4470/*!-
4471 Returns the position of this touch point, relative to the widget-
4472 or QGraphicsItem that received the event.-
4473-
4474 \sa startPos(), lastPos(), screenPos(), scenePos(), normalizedPos()-
4475*/-
4476QPointF QTouchEvent::TouchPoint::pos() const-
4477{-
4478 return d->rect.center();
never executed: return d->rect.center();
0
4479}-
4480-
4481/*!-
4482 Returns the scene position of this touch point.-
4483-
4484 The scene position is the position in QGraphicsScene coordinates-
4485 if the QTouchEvent is handled by a QGraphicsItem::touchEvent()-
4486 reimplementation, and identical to the screen position for-
4487 widgets.-
4488-
4489 \sa startScenePos(), lastScenePos(), pos()-
4490*/-
4491QPointF QTouchEvent::TouchPoint::scenePos() const-
4492{-
4493 return d->sceneRect.center();
never executed: return d->sceneRect.center();
0
4494}-
4495-
4496/*!-
4497 Returns the screen position of this touch point.-
4498-
4499 \sa startScreenPos(), lastScreenPos(), pos()-
4500*/-
4501QPointF QTouchEvent::TouchPoint::screenPos() const-
4502{-
4503 return d->screenRect.center();
never executed: return d->screenRect.center();
0
4504}-
4505-
4506/*!-
4507 Returns the normalized position of this touch point.-
4508-
4509 The coordinates are normalized to the size of the touch device,-
4510 i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.-
4511-
4512 \sa startNormalizedPos(), lastNormalizedPos(), pos()-
4513*/-
4514QPointF QTouchEvent::TouchPoint::normalizedPos() const-
4515{-
4516 return d->normalizedPos;
never executed: return d->normalizedPos;
0
4517}-
4518-
4519/*!-
4520 Returns the starting position of this touch point, relative to the-
4521 widget or QGraphicsItem that received the event.-
4522-
4523 \sa pos(), lastPos()-
4524*/-
4525QPointF QTouchEvent::TouchPoint::startPos() const-
4526{-
4527 return d->startPos;
never executed: return d->startPos;
0
4528}-
4529-
4530/*!-
4531 Returns the starting scene position of this touch point.-
4532-
4533 The scene position is the position in QGraphicsScene coordinates-
4534 if the QTouchEvent is handled by a QGraphicsItem::touchEvent()-
4535 reimplementation, and identical to the screen position for-
4536 widgets.-
4537-
4538 \sa scenePos(), lastScenePos()-
4539*/-
4540QPointF QTouchEvent::TouchPoint::startScenePos() const-
4541{-
4542 return d->startScenePos;
never executed: return d->startScenePos;
0
4543}-
4544-
4545/*!-
4546 Returns the starting screen position of this touch point.-
4547-
4548 \sa screenPos(), lastScreenPos()-
4549*/-
4550QPointF QTouchEvent::TouchPoint::startScreenPos() const-
4551{-
4552 return d->startScreenPos;
never executed: return d->startScreenPos;
0
4553}-
4554-
4555/*!-
4556 Returns the normalized starting position of this touch point.-
4557-
4558 The coordinates are normalized to the size of the touch device,-
4559 i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.-
4560-
4561 \sa normalizedPos(), lastNormalizedPos()-
4562*/-
4563QPointF QTouchEvent::TouchPoint::startNormalizedPos() const-
4564{-
4565 return d->startNormalizedPos;
never executed: return d->startNormalizedPos;
0
4566}-
4567-
4568/*!-
4569 Returns the position of this touch point from the previous touch-
4570 event, relative to the widget or QGraphicsItem that received the event.-
4571-
4572 \sa pos(), startPos()-
4573*/-
4574QPointF QTouchEvent::TouchPoint::lastPos() const-
4575{-
4576 return d->lastPos;
never executed: return d->lastPos;
0
4577}-
4578-
4579/*!-
4580 Returns the scene position of this touch point from the previous-
4581 touch event.-
4582-
4583 The scene position is the position in QGraphicsScene coordinates-
4584 if the QTouchEvent is handled by a QGraphicsItem::touchEvent()-
4585 reimplementation, and identical to the screen position for-
4586 widgets.-
4587-
4588 \sa scenePos(), startScenePos()-
4589*/-
4590QPointF QTouchEvent::TouchPoint::lastScenePos() const-
4591{-
4592 return d->lastScenePos;
never executed: return d->lastScenePos;
0
4593}-
4594-
4595/*!-
4596 Returns the screen position of this touch point from the previous-
4597 touch event.-
4598-
4599 \sa screenPos(), startScreenPos()-
4600*/-
4601QPointF QTouchEvent::TouchPoint::lastScreenPos() const-
4602{-
4603 return d->lastScreenPos;
never executed: return d->lastScreenPos;
0
4604}-
4605-
4606/*!-
4607 Returns the normalized position of this touch point from the-
4608 previous touch event.-
4609-
4610 The coordinates are normalized to the size of the touch device,-
4611 i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.-
4612-
4613 \sa normalizedPos(), startNormalizedPos()-
4614*/-
4615QPointF QTouchEvent::TouchPoint::lastNormalizedPos() const-
4616{-
4617 return d->lastNormalizedPos;
never executed: return d->lastNormalizedPos;
0
4618}-
4619-
4620/*!-
4621 Returns the rect for this touch point, relative to the widget-
4622 or QGraphicsItem that received the event. The rect is centered-
4623 around the point returned by pos().-
4624-
4625 \note This function returns an empty rect if the device does not report touch point sizes.-
4626*/-
4627QRectF QTouchEvent::TouchPoint::rect() const-
4628{-
4629 return d->rect;
never executed: return d->rect;
0
4630}-
4631-
4632/*!-
4633 Returns the rect for this touch point in scene coordinates.-
4634-
4635 \note This function returns an empty rect if the device does not report touch point sizes.-
4636-
4637 \sa scenePos(), rect()-
4638*/-
4639QRectF QTouchEvent::TouchPoint::sceneRect() const-
4640{-
4641 return d->sceneRect;
never executed: return d->sceneRect;
0
4642}-
4643-
4644/*!-
4645 Returns the rect for this touch point in screen coordinates.-
4646-
4647 \note This function returns an empty rect if the device does not report touch point sizes.-
4648-
4649 \sa screenPos(), rect()-
4650*/-
4651QRectF QTouchEvent::TouchPoint::screenRect() const-
4652{-
4653 return d->screenRect;
never executed: return d->screenRect;
0
4654}-
4655-
4656/*!-
4657 Returns the pressure of this touch point. The return value is in-
4658 the range 0.0 to 1.0.-
4659*/-
4660qreal QTouchEvent::TouchPoint::pressure() const-
4661{-
4662 return d->pressure;
never executed: return d->pressure;
0
4663}-
4664-
4665/*!-
4666 Returns a velocity vector for this touch point.-
4667 The vector is in the screen's coordinate system, using pixels per seconds for the magnitude.-
4668-
4669 \note The returned vector is only valid if the touch device's capabilities include QTouchDevice::Velocity.-
4670-
4671 \sa QTouchDevice::capabilities(), device()-
4672*/-
4673QVector2D QTouchEvent::TouchPoint::velocity() const-
4674{-
4675 return d->velocity;
never executed: return d->velocity;
0
4676}-
4677-
4678/*!-
4679 Returns additional information about the touch point.-
4680-
4681 \sa QTouchEvent::TouchPoint::InfoFlags-
4682 */-
4683QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const-
4684{-
4685 return d->flags;
never executed: return d->flags;
0
4686}-
4687-
4688/*!-
4689 \since 5.0-
4690 Returns the raw, unfiltered positions for the touch point. The positions are in native screen coordinates.-
4691 To get local coordinates you can use mapFromGlobal() of the QWindow returned by QTouchEvent::window().-
4692-
4693 \note Returns an empty vector if the touch device's capabilities do not include QTouchDevice::RawPositions.-
4694-
4695 \note Native screen coordinates refer to the native orientation of the screen which, in case of-
4696 mobile devices, is typically portrait. This means that on systems capable of screen orientation-
4697 changes the positions in this list will not reflect the current orientation (unlike pos(),-
4698 screenPos(), etc.) and will always be reported in the native orientation.-
4699-
4700 \sa QTouchDevice::capabilities(), device(), window()-
4701 */-
4702QVector<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const-
4703{-
4704 return d->rawScreenPositions;
never executed: return d->rawScreenPositions;
0
4705}-
4706-
4707/*! \internal */-
4708void QTouchEvent::TouchPoint::setId(int id)-
4709{-
4710 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4711 d = d->detach();
never executed: d = d->detach();
0
4712 d->id = id;-
4713}
never executed: end of block
0
4714-
4715/*! \internal */-
4716void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state)-
4717{-
4718 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4719 d = d->detach();
never executed: d = d->detach();
0
4720 d->state = state;-
4721}
never executed: end of block
0
4722-
4723/*! \internal */-
4724void QTouchEvent::TouchPoint::setPos(const QPointF &pos)-
4725{-
4726 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4727 d = d->detach();
never executed: d = d->detach();
0
4728 d->rect.moveCenter(pos);-
4729}
never executed: end of block
0
4730-
4731/*! \internal */-
4732void QTouchEvent::TouchPoint::setScenePos(const QPointF &scenePos)-
4733{-
4734 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4735 d = d->detach();
never executed: d = d->detach();
0
4736 d->sceneRect.moveCenter(scenePos);-
4737}
never executed: end of block
0
4738-
4739/*! \internal */-
4740void QTouchEvent::TouchPoint::setScreenPos(const QPointF &screenPos)-
4741{-
4742 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4743 d = d->detach();
never executed: d = d->detach();
0
4744 d->screenRect.moveCenter(screenPos);-
4745}
never executed: end of block
0
4746-
4747/*! \internal */-
4748void QTouchEvent::TouchPoint::setNormalizedPos(const QPointF &normalizedPos)-
4749{-
4750 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4751 d = d->detach();
never executed: d = d->detach();
0
4752 d->normalizedPos = normalizedPos;-
4753}
never executed: end of block
0
4754-
4755/*! \internal */-
4756void QTouchEvent::TouchPoint::setStartPos(const QPointF &startPos)-
4757{-
4758 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4759 d = d->detach();
never executed: d = d->detach();
0
4760 d->startPos = startPos;-
4761}
never executed: end of block
0
4762-
4763/*! \internal */-
4764void QTouchEvent::TouchPoint::setStartScenePos(const QPointF &startScenePos)-
4765{-
4766 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4767 d = d->detach();
never executed: d = d->detach();
0
4768 d->startScenePos = startScenePos;-
4769}
never executed: end of block
0
4770-
4771/*! \internal */-
4772void QTouchEvent::TouchPoint::setStartScreenPos(const QPointF &startScreenPos)-
4773{-
4774 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4775 d = d->detach();
never executed: d = d->detach();
0
4776 d->startScreenPos = startScreenPos;-
4777}
never executed: end of block
0
4778-
4779/*! \internal */-
4780void QTouchEvent::TouchPoint::setStartNormalizedPos(const QPointF &startNormalizedPos)-
4781{-
4782 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4783 d = d->detach();
never executed: d = d->detach();
0
4784 d->startNormalizedPos = startNormalizedPos;-
4785}
never executed: end of block
0
4786-
4787/*! \internal */-
4788void QTouchEvent::TouchPoint::setLastPos(const QPointF &lastPos)-
4789{-
4790 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4791 d = d->detach();
never executed: d = d->detach();
0
4792 d->lastPos = lastPos;-
4793}
never executed: end of block
0
4794-
4795/*! \internal */-
4796void QTouchEvent::TouchPoint::setLastScenePos(const QPointF &lastScenePos)-
4797{-
4798 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4799 d = d->detach();
never executed: d = d->detach();
0
4800 d->lastScenePos = lastScenePos;-
4801}
never executed: end of block
0
4802-
4803/*! \internal */-
4804void QTouchEvent::TouchPoint::setLastScreenPos(const QPointF &lastScreenPos)-
4805{-
4806 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4807 d = d->detach();
never executed: d = d->detach();
0
4808 d->lastScreenPos = lastScreenPos;-
4809}
never executed: end of block
0
4810-
4811/*! \internal */-
4812void QTouchEvent::TouchPoint::setLastNormalizedPos(const QPointF &lastNormalizedPos)-
4813{-
4814 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4815 d = d->detach();
never executed: d = d->detach();
0
4816 d->lastNormalizedPos = lastNormalizedPos;-
4817}
never executed: end of block
0
4818-
4819/*! \internal */-
4820void QTouchEvent::TouchPoint::setRect(const QRectF &rect)-
4821{-
4822 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4823 d = d->detach();
never executed: d = d->detach();
0
4824 d->rect = rect;-
4825}
never executed: end of block
0
4826-
4827/*! \internal */-
4828void QTouchEvent::TouchPoint::setSceneRect(const QRectF &sceneRect)-
4829{-
4830 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4831 d = d->detach();
never executed: d = d->detach();
0
4832 d->sceneRect = sceneRect;-
4833}
never executed: end of block
0
4834-
4835/*! \internal */-
4836void QTouchEvent::TouchPoint::setScreenRect(const QRectF &screenRect)-
4837{-
4838 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4839 d = d->detach();
never executed: d = d->detach();
0
4840 d->screenRect = screenRect;-
4841}
never executed: end of block
0
4842-
4843/*! \internal */-
4844void QTouchEvent::TouchPoint::setPressure(qreal pressure)-
4845{-
4846 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4847 d = d->detach();
never executed: d = d->detach();
0
4848 d->pressure = pressure;-
4849}
never executed: end of block
0
4850-
4851/*! \internal */-
4852void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v)-
4853{-
4854 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4855 d = d->detach();
never executed: d = d->detach();
0
4856 d->velocity = v;-
4857}
never executed: end of block
0
4858-
4859/*! \internal */-
4860void QTouchEvent::TouchPoint::setRawScreenPositions(const QVector<QPointF> &positions)-
4861{-
4862 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4863 d = d->detach();
never executed: d = d->detach();
0
4864 d->rawScreenPositions = positions;-
4865}
never executed: end of block
0
4866-
4867/*!-
4868 \internal-
4869*/-
4870void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)-
4871{-
4872 if (d->ref.load() != 1)
d->ref.load() != 1Description
TRUEnever evaluated
FALSEnever evaluated
0
4873 d = d->detach();
never executed: d = d->detach();
0
4874 d->flags = flags;-
4875}
never executed: end of block
0
4876-
4877/*!-
4878 \fn TouchPoint &TouchPoint::operator=(const TouchPoint &other)-
4879 \internal-
4880 */-
4881-
4882/*!-
4883 \fn TouchPoint &TouchPoint::operator=(TouchPoint &&other)-
4884 \internal-
4885 */-
4886/*!-
4887 \fn void QTouchEvent::TouchPoint::swap(TouchPoint &other);-
4888 \internal-
4889*/-
4890-
4891/*!-
4892 \class QScrollPrepareEvent-
4893 \since 4.8-
4894 \ingroup events-
4895 \inmodule QtGui-
4896-
4897 \brief The QScrollPrepareEvent class is sent in preparation of scrolling.-
4898-
4899 The scroll prepare event is sent before scrolling (usually by QScroller) is started.-
4900 The object receiving this event should set viewportSize, maxContentPos and contentPos.-
4901 It also should accept this event to indicate that scrolling should be started.-
4902-
4903 It is not guaranteed that a QScrollEvent will be sent after an acceepted-
4904 QScrollPrepareEvent, e.g. in a case where the maximum content position is (0,0).-
4905-
4906 \sa QScrollEvent, QScroller-
4907*/-
4908-
4909/*!-
4910 Creates new QScrollPrepareEvent-
4911 The \a startPos is the position of a touch or mouse event that started the scrolling.-
4912*/-
4913QScrollPrepareEvent::QScrollPrepareEvent(const QPointF &startPos)-
4914 : QEvent(QEvent::ScrollPrepare), m_target(0), m_startPos(startPos)-
4915{-
4916 Q_UNUSED(m_target);-
4917}
never executed: end of block
0
4918-
4919/*!-
4920 Destroys QScrollEvent.-
4921*/-
4922QScrollPrepareEvent::~QScrollPrepareEvent()-
4923{-
4924}-
4925-
4926/*!-
4927 Returns the position of the touch or mouse event that started the scrolling.-
4928*/-
4929QPointF QScrollPrepareEvent::startPos() const-
4930{-
4931 return m_startPos;
never executed: return m_startPos;
0
4932}-
4933-
4934/*!-
4935 Returns size of the area that is to be scrolled as set by setViewportSize-
4936-
4937 \sa setViewportSize()-
4938*/-
4939QSizeF QScrollPrepareEvent::viewportSize() const-
4940{-
4941 return m_viewportSize;
never executed: return m_viewportSize;
0
4942}-
4943-
4944/*!-
4945 Returns the range of coordinates for the content as set by setContentPosRange().-
4946*/-
4947QRectF QScrollPrepareEvent::contentPosRange() const-
4948{-
4949 return m_contentPosRange;
never executed: return m_contentPosRange;
0
4950}-
4951-
4952/*!-
4953 Returns the current position of the content as set by setContentPos.-
4954*/-
4955QPointF QScrollPrepareEvent::contentPos() const-
4956{-
4957 return m_contentPos;
never executed: return m_contentPos;
0
4958}-
4959-
4960-
4961/*!-
4962 Sets the size of the area that is to be scrolled to \a size.-
4963-
4964 \sa viewportSize()-
4965*/-
4966void QScrollPrepareEvent::setViewportSize(const QSizeF &size)-
4967{-
4968 m_viewportSize = size;-
4969}
never executed: end of block
0
4970-
4971/*!-
4972 Sets the range of content coordinates to \a rect.-
4973-
4974 \sa contentPosRange()-
4975*/-
4976void QScrollPrepareEvent::setContentPosRange(const QRectF &rect)-
4977{-
4978 m_contentPosRange = rect;-
4979}
never executed: end of block
0
4980-
4981/*!-
4982 Sets the current content position to \a pos.-
4983-
4984 \sa contentPos()-
4985*/-
4986void QScrollPrepareEvent::setContentPos(const QPointF &pos)-
4987{-
4988 m_contentPos = pos;-
4989}
never executed: end of block
0
4990-
4991-
4992/*!-
4993 \class QScrollEvent-
4994 \since 4.8-
4995 \ingroup events-
4996 \inmodule QtGui-
4997-
4998 \brief The QScrollEvent class is sent when scrolling.-
4999-
5000 The scroll event is sent to indicate that the receiver should be scrolled.-
5001 Usually the receiver should be something visual like QWidget or QGraphicsObject.-
5002-
5003 Some care should be taken that no conflicting QScrollEvents are sent from two-
5004 sources. Using QScroller::scrollTo is save however.-
5005-
5006 \sa QScrollPrepareEvent, QScroller-
5007*/-
5008-
5009/*!-
5010 \enum QScrollEvent::ScrollState-
5011-
5012 This enum describes the states a scroll event can have.-
5013-
5014 \value ScrollStarted Set for the first scroll event of a scroll activity.-
5015-
5016 \value ScrollUpdated Set for all but the first and the last scroll event of a scroll activity.-
5017-
5018 \value ScrollFinished Set for the last scroll event of a scroll activity.-
5019-
5020 \sa QScrollEvent::scrollState()-
5021*/-
5022-
5023/*!-
5024 Creates a new QScrollEvent-
5025 \a contentPos is the new content position, \a overshootDistance is the-
5026 new overshoot distance while \a scrollState indicates if this scroll-
5027 event is the first one, the last one or some event in between.-
5028*/-
5029QScrollEvent::QScrollEvent(const QPointF &contentPos, const QPointF &overshootDistance, ScrollState scrollState)-
5030 : QEvent(QEvent::Scroll), m_contentPos(contentPos), m_overshoot(overshootDistance), m_state(scrollState)-
5031{-
5032}
never executed: end of block
0
5033-
5034/*!-
5035 Destroys QScrollEvent.-
5036*/-
5037QScrollEvent::~QScrollEvent()-
5038{-
5039}-
5040-
5041/*!-
5042 Returns the new scroll position.-
5043*/-
5044QPointF QScrollEvent::contentPos() const-
5045{-
5046 return m_contentPos;
never executed: return m_contentPos;
0
5047}-
5048-
5049/*!-
5050 Returns the new overshoot distance.-
5051 See QScroller for an explanation of the term overshoot.-
5052-
5053 \sa QScroller-
5054*/-
5055QPointF QScrollEvent::overshootDistance() const-
5056{-
5057 return m_overshoot;
never executed: return m_overshoot;
0
5058}-
5059-
5060/*!-
5061 Returns the current scroll state as a combination of ScrollStateFlag values.-
5062 ScrollStarted (or ScrollFinished) will be set, if this scroll event is the first (or last) event in a scrolling activity.-
5063 Please note that both values can be set at the same time, if the activity consists of a single QScrollEvent.-
5064 All other scroll events in between will have their state set to ScrollUpdated.-
5065-
5066 A widget could for example revert selections when scrolling is started and stopped.-
5067*/-
5068QScrollEvent::ScrollState QScrollEvent::scrollState() const-
5069{-
5070 return m_state;
never executed: return m_state;
0
5071}-
5072-
5073/*!-
5074 Creates a new QScreenOrientationChangeEvent-
5075 \a orientation is the new orientation of the screen.-
5076*/-
5077QScreenOrientationChangeEvent::QScreenOrientationChangeEvent(QScreen *screen, Qt::ScreenOrientation screenOrientation)-
5078 : QEvent(QEvent::OrientationChange), m_screen(screen), m_orientation(screenOrientation)-
5079{-
5080}
never executed: end of block
0
5081-
5082/*!-
5083 Destroys QScreenOrientationChangeEvent.-
5084*/-
5085QScreenOrientationChangeEvent::~QScreenOrientationChangeEvent()-
5086{-
5087}-
5088-
5089/*!-
5090 Returns the screen whose orientation changed.-
5091*/-
5092QScreen *QScreenOrientationChangeEvent::screen() const-
5093{-
5094 return m_screen;
never executed: return m_screen;
0
5095}-
5096-
5097/*!-
5098 Returns the orientation of the screen.-
5099*/-
5100Qt::ScreenOrientation QScreenOrientationChangeEvent::orientation() const-
5101{-
5102 return m_orientation;
never executed: return m_orientation;
0
5103}-
5104-
5105/*!-
5106 Creates a new QApplicationStateChangeEvent.-
5107 \a applicationState is the new state.-
5108*/-
5109QApplicationStateChangeEvent::QApplicationStateChangeEvent(Qt::ApplicationState applicationState)-
5110 : QEvent(QEvent::ApplicationStateChange), m_applicationState(applicationState)-
5111{-
5112}
never executed: end of block
0
5113-
5114/*!-
5115 Returns the state of the application.-
5116*/-
5117Qt::ApplicationState QApplicationStateChangeEvent::applicationState() const-
5118{-
5119 return m_applicationState;
never executed: return m_applicationState;
0
5120}-
5121-
5122QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9