kernel/qevent.cpp

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

Generated by Squish Coco Non-Commercial