kernel/qevent.cpp

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

Generated by Squish Coco Non-Commercial