Line | Source Code | Coverage |
---|
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 "qplatformdefs.h" | - |
43 | #include "qabstracteventdispatcher.h" | - |
44 | #include "qapplication.h" | - |
45 | #include "qclipboard.h" | - |
46 | #include "qcursor.h" | - |
47 | #include "qdesktopwidget.h" | - |
48 | #include "qdir.h" | - |
49 | #include "qevent.h" | - |
50 | #include "qfile.h" | - |
51 | #include "qfileinfo.h" | - |
52 | #include "qgraphicsscene.h" | - |
53 | #include "qhash.h" | - |
54 | #include "qset.h" | - |
55 | #include "qlayout.h" | - |
56 | #include "qstyle.h" | - |
57 | #include "qstyleoption.h" | - |
58 | #include "qstylefactory.h" | - |
59 | #include "qtextcodec.h" | - |
60 | #include "qtranslator.h" | - |
61 | #include "qvariant.h" | - |
62 | #include "qwidget.h" | - |
63 | #include "private/qdnd_p.h" | - |
64 | #include "private/qguiapplication_p.h" | - |
65 | #include "qcolormap.h" | - |
66 | #include "qdebug.h" | - |
67 | #include "private/qstylesheetstyle_p.h" | - |
68 | #include "private/qstyle_p.h" | - |
69 | #include "qmessagebox.h" | - |
70 | #include "qwidgetwindow_qpa_p.h" | - |
71 | #include <QtWidgets/qgraphicsproxywidget.h> | - |
72 | #include <QtGui/qstylehints.h> | - |
73 | #include <QtGui/qinputmethod.h> | - |
74 | #include <qpa/qplatformtheme.h> | - |
75 | | - |
76 | #include "private/qkeymapper_p.h" | - |
77 | | - |
78 | #include <qthread.h> | - |
79 | #include <private/qthread_p.h> | - |
80 | | - |
81 | #include <private/qfont_p.h> | - |
82 | | - |
83 | #include <stdlib.h> | - |
84 | | - |
85 | #include "qapplication_p.h" | - |
86 | #include "private/qevent_p.h" | - |
87 | #include "qwidget_p.h" | - |
88 | | - |
89 | #include "qgesture.h" | - |
90 | #include "private/qgesturemanager_p.h" | - |
91 | #include <qpa/qplatformfontdatabase.h> | - |
92 | #ifndef QT_NO_LIBRARY | - |
93 | #include "qlibrary.h" | - |
94 | #endif | - |
95 | | - |
96 | #include "qdatetime.h" | - |
97 | | - |
98 | #ifdef Q_OS_WINCE | - |
99 | extern bool qt_wince_is_smartphone(); //qguifunctions_wince.cpp | - |
100 | extern bool qt_wince_is_mobile(); //qguifunctions_wince.cpp | - |
101 | extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp | - |
102 | #endif | - |
103 | | - |
104 | #include <qpa/qplatformwindow.h> | - |
105 | | - |
106 | //#define ALIEN_DEBUG | - |
107 | | - |
108 | static void initResources() | - |
109 | { | - |
110 | #if defined(Q_OS_WINCE) | - |
111 | Q_INIT_RESOURCE_EXTERN(qstyle_wince) | - |
112 | Q_INIT_RESOURCE(qstyle_wince); | - |
113 | #else | - |
114 | Q_INIT_RESOURCE_EXTERN(qstyle) executed (the execution status of this line is deduced): extern int qInitResources_qstyle (); | - |
115 | Q_INIT_RESOURCE(qstyle); executed: } Execution Count:215 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:215 |
| 0-215 |
116 | #endif | - |
117 | Q_INIT_RESOURCE_EXTERN(qmessagebox) executed (the execution status of this line is deduced): extern int qInitResources_qmessagebox (); | - |
118 | Q_INIT_RESOURCE(qmessagebox); executed: } Execution Count:215 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:215 |
| 0-215 |
119 | | - |
120 | } executed: } Execution Count:215 | 215 |
121 | | - |
122 | QT_BEGIN_NAMESPACE | - |
123 | | - |
124 | Q_CORE_EXPORT void qt_call_post_routines(); | - |
125 | | - |
126 | QApplicationPrivate *QApplicationPrivate::self = 0; | - |
127 | | - |
128 | static void initSystemPalette() | - |
129 | { | - |
130 | if (!QApplicationPrivate::sys_pal) { partially evaluated: !QApplicationPrivate::sys_pal yes Evaluation Count:214 | no Evaluation Count:0 |
| 0-214 |
131 | QPalette defaultPlatte; executed (the execution status of this line is deduced): QPalette defaultPlatte; | - |
132 | if (QApplicationPrivate::app_style) partially evaluated: QApplicationPrivate::app_style yes Evaluation Count:214 | no Evaluation Count:0 |
| 0-214 |
133 | defaultPlatte = QApplicationPrivate::app_style->standardPalette(); executed: defaultPlatte = QApplicationPrivate::app_style->standardPalette(); Execution Count:214 | 214 |
134 | if (const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette()) { partially evaluated: const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette() no Evaluation Count:0 | yes Evaluation Count:214 |
| 0-214 |
135 | QApplicationPrivate::setSystemPalette(themePalette->resolve(defaultPlatte)); never executed (the execution status of this line is deduced): QApplicationPrivate::setSystemPalette(themePalette->resolve(defaultPlatte)); | - |
136 | QApplicationPrivate::initializeWidgetPaletteHash(); never executed (the execution status of this line is deduced): QApplicationPrivate::initializeWidgetPaletteHash(); | - |
137 | } else { | 0 |
138 | QApplicationPrivate::setSystemPalette(defaultPlatte); executed (the execution status of this line is deduced): QApplicationPrivate::setSystemPalette(defaultPlatte); | - |
139 | } executed: } Execution Count:214 | 214 |
140 | } | - |
141 | } executed: } Execution Count:214 | 214 |
142 | | - |
143 | static void clearSystemPalette() | - |
144 | { | - |
145 | delete QApplicationPrivate::sys_pal; executed (the execution status of this line is deduced): delete QApplicationPrivate::sys_pal; | - |
146 | QApplicationPrivate::sys_pal = 0; executed (the execution status of this line is deduced): QApplicationPrivate::sys_pal = 0; | - |
147 | } executed: } Execution Count:213 | 213 |
148 | | - |
149 | #ifdef Q_OS_WINCE | - |
150 | int QApplicationPrivate::autoMaximizeThreshold = -1; | - |
151 | bool QApplicationPrivate::autoSipEnabled = false; | - |
152 | #else | - |
153 | bool QApplicationPrivate::autoSipEnabled = true; | - |
154 | #endif | - |
155 | | - |
156 | QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags) | - |
157 | : QApplicationPrivateBase(argc, argv, flags) | - |
158 | { | - |
159 | application_type = QApplicationPrivate::Gui; executed (the execution status of this line is deduced): application_type = QApplicationPrivate::Gui; | - |
160 | | - |
161 | #ifndef QT_NO_GESTURES | - |
162 | gestureManager = 0; executed (the execution status of this line is deduced): gestureManager = 0; | - |
163 | gestureWidget = 0; executed (the execution status of this line is deduced): gestureWidget = 0; | - |
164 | #endif // QT_NO_GESTURES | - |
165 | | - |
166 | if (!self) partially evaluated: !self yes Evaluation Count:215 | no Evaluation Count:0 |
| 0-215 |
167 | self = this; executed: self = this; Execution Count:215 | 215 |
168 | } executed: } Execution Count:215 | 215 |
169 | | - |
170 | QApplicationPrivate::~QApplicationPrivate() | - |
171 | { | - |
172 | if (self == this) partially evaluated: self == this yes Evaluation Count:213 | no Evaluation Count:0 |
| 0-213 |
173 | self = 0; executed: self = 0; Execution Count:213 | 213 |
174 | } executed: } Execution Count:213 | 213 |
175 | | - |
176 | /*! | - |
177 | \class QApplication | - |
178 | \brief The QApplication class manages the GUI application's control | - |
179 | flow and main settings. | - |
180 | | - |
181 | \inmodule QtWidgets | - |
182 | | - |
183 | QApplication specializes QGuiApplication with some functionality needed | - |
184 | for QWidget-based applications. It handles widget specific initialization, | - |
185 | finalization. | - |
186 | | - |
187 | For any GUI application using Qt, there is precisely \b one QApplication | - |
188 | object, no matter whether the application has 0, 1, 2 or more windows at | - |
189 | any given time. For non-QWidget based Qt applications, use QGuiApplication instead, | - |
190 | as it does not depend on the \l QtWidgets library. | - |
191 | | - |
192 | Some GUI applications provide a special batch mode ie. provide command line | - |
193 | arguments for executing tasks without manual intervention. In such non-GUI | - |
194 | mode, it is often sufficient to instantiate a plain QCoreApplication to | - |
195 | avoid unnecessarily initializing resources needed for a graphical user | - |
196 | interface. The following example shows how to dynamically create an | - |
197 | appropriate type of application instance: | - |
198 | | - |
199 | \snippet code/src_gui_kernel_qapplication.cpp 0 | - |
200 | | - |
201 | The QApplication object is accessible through the instance() function that | - |
202 | returns a pointer equivalent to the global qApp pointer. | - |
203 | | - |
204 | QApplication's main areas of responsibility are: | - |
205 | \list | - |
206 | \li It initializes the application with the user's desktop settings | - |
207 | such as palette(), font() and doubleClickInterval(). It keeps | - |
208 | track of these properties in case the user changes the desktop | - |
209 | globally, for example through some kind of control panel. | - |
210 | | - |
211 | \li It performs event handling, meaning that it receives events | - |
212 | from the underlying window system and dispatches them to the | - |
213 | relevant widgets. By using sendEvent() and postEvent() you can | - |
214 | send your own events to widgets. | - |
215 | | - |
216 | \li It parses common command line arguments and sets its internal | - |
217 | state accordingly. See the \l{QApplication::QApplication()} | - |
218 | {constructor documentation} below for more details. | - |
219 | | - |
220 | \li It defines the application's look and feel, which is | - |
221 | encapsulated in a QStyle object. This can be changed at runtime | - |
222 | with setStyle(). | - |
223 | | - |
224 | \li It specifies how the application is to allocate colors. See | - |
225 | setColorSpec() for details. | - |
226 | | - |
227 | \li It provides localization of strings that are visible to the | - |
228 | user via translate(). | - |
229 | | - |
230 | \li It provides some magical objects like the desktop() and the | - |
231 | clipboard(). | - |
232 | | - |
233 | \li It knows about the application's windows. You can ask which | - |
234 | widget is at a certain position using widgetAt(), get a list of | - |
235 | topLevelWidgets() and closeAllWindows(), etc. | - |
236 | | - |
237 | \li It manages the application's mouse cursor handling, see | - |
238 | setOverrideCursor() | - |
239 | \endlist | - |
240 | | - |
241 | Since the QApplication object does so much initialization, it \e{must} be | - |
242 | created before any other objects related to the user interface are created. | - |
243 | QApplication also deals with common command line arguments. Hence, it is | - |
244 | usually a good idea to create it \e before any interpretation or | - |
245 | modification of \c argv is done in the application itself. | - |
246 | | - |
247 | \table | - |
248 | \header | - |
249 | \li{2,1} Groups of functions | - |
250 | | - |
251 | \row | - |
252 | \li System settings | - |
253 | \li desktopSettingsAware(), | - |
254 | setDesktopSettingsAware(), | - |
255 | cursorFlashTime(), | - |
256 | setCursorFlashTime(), | - |
257 | doubleClickInterval(), | - |
258 | setDoubleClickInterval(), | - |
259 | setKeyboardInputInterval(), | - |
260 | wheelScrollLines(), | - |
261 | setWheelScrollLines(), | - |
262 | palette(), | - |
263 | setPalette(), | - |
264 | font(), | - |
265 | setFont(), | - |
266 | fontMetrics(). | - |
267 | | - |
268 | \row | - |
269 | \li Event handling | - |
270 | \li exec(), | - |
271 | processEvents(), | - |
272 | exit(), | - |
273 | quit(). | - |
274 | sendEvent(), | - |
275 | postEvent(), | - |
276 | sendPostedEvents(), | - |
277 | removePostedEvents(), | - |
278 | hasPendingEvents(), | - |
279 | notify(). | - |
280 | | - |
281 | \row | - |
282 | \li GUI Styles | - |
283 | \li style(), | - |
284 | setStyle(). | - |
285 | | - |
286 | \row | - |
287 | \li Color usage | - |
288 | \li colorSpec(), | - |
289 | setColorSpec(). | - |
290 | | - |
291 | \row | - |
292 | \li Text handling | - |
293 | \li installTranslator(), | - |
294 | removeTranslator() | - |
295 | translate(). | - |
296 | | - |
297 | \row | - |
298 | \li Widgets | - |
299 | \li allWidgets(), | - |
300 | topLevelWidgets(), | - |
301 | desktop(), | - |
302 | activePopupWidget(), | - |
303 | activeModalWidget(), | - |
304 | clipboard(), | - |
305 | focusWidget(), | - |
306 | activeWindow(), | - |
307 | widgetAt(). | - |
308 | | - |
309 | \row | - |
310 | \li Advanced cursor handling | - |
311 | \li overrideCursor(), | - |
312 | setOverrideCursor(), | - |
313 | restoreOverrideCursor(). | - |
314 | | - |
315 | \row | - |
316 | \li Miscellaneous | - |
317 | \li closeAllWindows(), | - |
318 | startingUp(), | - |
319 | closingDown(), | - |
320 | type(). | - |
321 | \endtable | - |
322 | | - |
323 | \sa QCoreApplication, QAbstractEventDispatcher, QEventLoop, QSettings | - |
324 | */ | - |
325 | | - |
326 | /*! | - |
327 | \enum QApplication::ColorSpec | - |
328 | | - |
329 | \value NormalColor the default color allocation policy | - |
330 | \value CustomColor the same as NormalColor for X11; allocates colors | - |
331 | to a palette on demand under Windows | - |
332 | \value ManyColor the right choice for applications that use thousands of | - |
333 | colors | - |
334 | | - |
335 | See setColorSpec() for full details. | - |
336 | */ | - |
337 | | - |
338 | /*! | - |
339 | \fn QWidget *QApplication::topLevelAt(const QPoint &point) | - |
340 | | - |
341 | Returns the top-level widget at the given \a point; returns 0 if | - |
342 | there is no such widget. | - |
343 | */ | - |
344 | | - |
345 | /*! | - |
346 | \fn QWidget *QApplication::topLevelAt(int x, int y) | - |
347 | | - |
348 | \overload | - |
349 | | - |
350 | Returns the top-level widget at the point (\a{x}, \a{y}); returns | - |
351 | 0 if there is no such widget. | - |
352 | */ | - |
353 | | - |
354 | | - |
355 | /* | - |
356 | The qt_init() and qt_cleanup() functions are implemented in the | - |
357 | qapplication_xyz.cpp file. | - |
358 | */ | - |
359 | | - |
360 | void qt_init(QApplicationPrivate *priv, int type | - |
361 | ); | - |
362 | void qt_cleanup(); | - |
363 | | - |
364 | QStyle *QApplicationPrivate::app_style = 0; // default application style | - |
365 | QString QApplicationPrivate::styleOverride; // style override | - |
366 | | - |
367 | #ifndef QT_NO_STYLE_STYLESHEET | - |
368 | QString QApplicationPrivate::styleSheet; // default application stylesheet | - |
369 | #endif | - |
370 | QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0; | - |
371 | | - |
372 | int QApplicationPrivate::app_cspec = QApplication::NormalColor; | - |
373 | | - |
374 | QPalette *QApplicationPrivate::sys_pal = 0; // default system palette | - |
375 | QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer | - |
376 | | - |
377 | QFont *QApplicationPrivate::sys_font = 0; // default system font | - |
378 | QFont *QApplicationPrivate::set_font = 0; // default font set by programmer | - |
379 | | - |
380 | QIcon *QApplicationPrivate::app_icon = 0; | - |
381 | QWidget *QApplicationPrivate::main_widget = 0; // main application widget | - |
382 | QWidget *QApplicationPrivate::focus_widget = 0; // has keyboard input focus | - |
383 | QWidget *QApplicationPrivate::hidden_focus_widget = 0; // will get keyboard input focus after show() | - |
384 | QWidget *QApplicationPrivate::active_window = 0; // toplevel with keyboard focus | - |
385 | #ifndef QT_NO_WHEELEVENT | - |
386 | int QApplicationPrivate::wheel_scroll_lines; // number of lines to scroll | - |
387 | #endif | - |
388 | bool qt_in_tab_key_event = false; | - |
389 | int qt_antialiasing_threshold = -1; | - |
390 | QSize QApplicationPrivate::app_strut = QSize(0,0); // no default application strut | - |
391 | int QApplicationPrivate::enabledAnimations = QPlatformTheme::GeneralUiEffect; | - |
392 | bool QApplicationPrivate::widgetCount = false; | - |
393 | bool QApplicationPrivate::load_testability = false; | - |
394 | #ifdef QT_KEYPAD_NAVIGATION | - |
395 | Qt::NavigationMode QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadTabOrder; | - |
396 | QWidget *QApplicationPrivate::oldEditFocus = 0; | - |
397 | #endif | - |
398 | | - |
399 | bool qt_tabletChokeMouse = false; | - |
400 | | - |
401 | inline bool QApplicationPrivate::isAlien(QWidget *widget) | - |
402 | { | - |
403 | return widget && !widget->isWindow(); executed: return widget && !widget->isWindow(); Execution Count:3839 | 3839 |
404 | } | - |
405 | | - |
406 | bool Q_WIDGETS_EXPORT qt_tab_all_widgets() | - |
407 | { | - |
408 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) partially evaluated: const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme() yes Evaluation Count:1768 | no Evaluation Count:0 |
| 0-1768 |
409 | return theme->themeHint(QPlatformTheme::TabAllWidgets).toBool(); executed: return theme->themeHint(QPlatformTheme::TabAllWidgets).toBool(); Execution Count:1768 | 1768 |
410 | return true; never executed: return true; | 0 |
411 | } | - |
412 | | - |
413 | // ######## move to QApplicationPrivate | - |
414 | // Default application palettes and fonts (per widget type) | - |
415 | Q_GLOBAL_STATIC(PaletteHash, app_palettes) never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:85793 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:136 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:136 | yes Evaluation Count:85657 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:136 | no Evaluation Count:0 |
| 0-85793 |
416 | PaletteHash *qt_app_palettes_hash() | - |
417 | { | - |
418 | return app_palettes(); never executed: return app_palettes(); | 0 |
419 | } | - |
420 | | - |
421 | Q_GLOBAL_STATIC(FontHash, app_fonts) never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:80659 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:136 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:136 | yes Evaluation Count:80523 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:136 | no Evaluation Count:0 |
| 0-80659 |
422 | FontHash *qt_app_fonts_hash() | - |
423 | { | - |
424 | return app_fonts(); executed: return app_fonts(); Execution Count:215 | 215 |
425 | } | - |
426 | | - |
427 | QWidgetList *QApplicationPrivate::popupWidgets = 0; // has keyboard input focus | - |
428 | | - |
429 | QDesktopWidget *qt_desktopWidget = 0; // root window widgets | - |
430 | | - |
431 | /*! | - |
432 | \internal | - |
433 | */ | - |
434 | void QApplicationPrivate::process_cmdline() | - |
435 | { | - |
436 | // process platform-indep command line | - |
437 | if (!qt_is_gui_used || !argc) partially evaluated: !qt_is_gui_used no Evaluation Count:0 | yes Evaluation Count:215 |
evaluated: !argc yes Evaluation Count:59 | yes Evaluation Count:156 |
| 0-215 |
438 | return; executed: return; Execution Count:59 | 59 |
439 | | - |
440 | int i, j; executed (the execution status of this line is deduced): int i, j; | - |
441 | | - |
442 | j = 1; executed (the execution status of this line is deduced): j = 1; | - |
443 | for (i=1; i<argc; i++) { // if you add anything here, modify QCoreApplication::arguments() evaluated: i<argc yes Evaluation Count:3 | yes Evaluation Count:156 |
| 3-156 |
444 | if (argv[i] && *argv[i] != '-') { partially evaluated: argv[i] yes Evaluation Count:3 | no Evaluation Count:0 |
partially evaluated: *argv[i] != '-' no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
445 | argv[j++] = argv[i]; never executed (the execution status of this line is deduced): argv[j++] = argv[i]; | - |
446 | continue; never executed: continue; | 0 |
447 | } | - |
448 | QByteArray arg = argv[i]; executed (the execution status of this line is deduced): QByteArray arg = argv[i]; | - |
449 | arg = arg; executed (the execution status of this line is deduced): arg = arg; | - |
450 | QString s; executed (the execution status of this line is deduced): QString s; | - |
451 | if (arg == "-qdevel" || arg == "-qdebug") { partially evaluated: arg == "-qdevel" no Evaluation Count:0 | yes Evaluation Count:3 |
partially evaluated: arg == "-qdebug" no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
452 | // obsolete argument | - |
453 | } else if (arg.indexOf("-style=", 0) != -1) { never executed: } partially evaluated: arg.indexOf("-style=", 0) != -1 no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
454 | s = QString::fromLocal8Bit(arg.right(arg.length() - 7).toLower()); never executed (the execution status of this line is deduced): s = QString::fromLocal8Bit(arg.right(arg.length() - 7).toLower()); | - |
455 | } else if (arg == "-style" && i < argc-1) { never executed: } evaluated: arg == "-style" yes Evaluation Count:2 | yes Evaluation Count:1 |
partially evaluated: i < argc-1 yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
456 | s = QString::fromLocal8Bit(argv[++i]).toLower(); executed (the execution status of this line is deduced): s = QString::fromLocal8Bit(argv[++i]).toLower(); | - |
457 | #ifndef QT_NO_STYLE_STYLESHEET | - |
458 | } else if (arg == "-stylesheet" && i < argc -1) { executed: } Execution Count:2 partially evaluated: arg == "-stylesheet" no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: i < argc -1 | 0-2 |
459 | styleSheet = QLatin1String("file:///"); never executed (the execution status of this line is deduced): styleSheet = QLatin1String("file:///"); | - |
460 | styleSheet.append(QString::fromLocal8Bit(argv[++i])); never executed (the execution status of this line is deduced): styleSheet.append(QString::fromLocal8Bit(argv[++i])); | - |
461 | } else if (arg.indexOf("-stylesheet=") != -1) { never executed: } partially evaluated: arg.indexOf("-stylesheet=") != -1 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
462 | styleSheet = QLatin1String("file:///"); never executed (the execution status of this line is deduced): styleSheet = QLatin1String("file:///"); | - |
463 | styleSheet.append(QString::fromLocal8Bit(arg.right(arg.length() - 12))); never executed (the execution status of this line is deduced): styleSheet.append(QString::fromLocal8Bit(arg.right(arg.length() - 12))); | - |
464 | #endif | - |
465 | } else if (qstrcmp(arg, "-widgetcount") == 0) { never executed: } partially evaluated: qstrcmp(arg, "-widgetcount") == 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
466 | widgetCount = true; never executed (the execution status of this line is deduced): widgetCount = true; | - |
467 | } else if (qstrcmp(arg, "-testability") == 0) { never executed: } partially evaluated: qstrcmp(arg, "-testability") == 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
468 | load_testability = true; never executed (the execution status of this line is deduced): load_testability = true; | - |
469 | } else { | 0 |
470 | argv[j++] = argv[i]; executed (the execution status of this line is deduced): argv[j++] = argv[i]; | - |
471 | } executed: } Execution Count:1 | 1 |
472 | if (!s.isEmpty()) { evaluated: !s.isEmpty() yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
473 | if (app_style) { partially evaluated: app_style no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
474 | delete app_style; never executed (the execution status of this line is deduced): delete app_style; | - |
475 | app_style = 0; never executed (the execution status of this line is deduced): app_style = 0; | - |
476 | } | 0 |
477 | styleOverride = s; executed (the execution status of this line is deduced): styleOverride = s; | - |
478 | } executed: } Execution Count:2 | 2 |
479 | } executed: } Execution Count:3 | 3 |
480 | | - |
481 | if(j < argc) { evaluated: j < argc yes Evaluation Count:2 | yes Evaluation Count:154 |
| 2-154 |
482 | argv[j] = 0; executed (the execution status of this line is deduced): argv[j] = 0; | - |
483 | argc = j; executed (the execution status of this line is deduced): argc = j; | - |
484 | } executed: } Execution Count:2 | 2 |
485 | } executed: } Execution Count:156 | 156 |
486 | | - |
487 | /*! | - |
488 | Initializes the window system and constructs an application object with | - |
489 | \a argc command line arguments in \a argv. | - |
490 | | - |
491 | \warning The data referred to by \a argc and \a argv must stay valid for | - |
492 | the entire lifetime of the QApplication object. In addition, \a argc must | - |
493 | be greater than zero and \a argv must contain at least one valid character | - |
494 | string. | - |
495 | | - |
496 | The global \c qApp pointer refers to this application object. Only one | - |
497 | application object should be created. | - |
498 | | - |
499 | This application object must be constructed before any \l{QPaintDevice} | - |
500 | {paint devices} (including widgets, pixmaps, bitmaps etc.). | - |
501 | | - |
502 | \note \a argc and \a argv might be changed as Qt removes command line | - |
503 | arguments that it recognizes. | - |
504 | | - |
505 | All Qt programs automatically support the following command line options: | - |
506 | \list | - |
507 | \li -style= \e style, sets the application GUI style. Possible values | - |
508 | depend on your system configuration. If you compiled Qt with | - |
509 | additional styles or have additional styles as plugins these will | - |
510 | be available to the \c -style command line option. You can also | - |
511 | set the style for all Qt applications by setting the | - |
512 | \c QT_STYLE_OVERRIDE environment variable. | - |
513 | \li -style \e style, is the same as listed above. | - |
514 | \li -stylesheet= \e stylesheet, sets the application \l styleSheet. The | - |
515 | value must be a path to a file that contains the Style Sheet. | - |
516 | \note Relative URLs in the Style Sheet file are relative to the | - |
517 | Style Sheet file's path. | - |
518 | \li -stylesheet \e stylesheet, is the same as listed above. | - |
519 | \li -widgetcount, prints debug message at the end about number of | - |
520 | widgets left undestroyed and maximum number of widgets existed at | - |
521 | the same time | - |
522 | \li -reverse, sets the application's layout direction to | - |
523 | Qt::RightToLeft | - |
524 | \li -qmljsdebugger=, activates the QML/JS debugger with a specified port. | - |
525 | The value must be of format port:1234[,block], where block is optional | - |
526 | and will make the application wait until a debugger connects to it. | - |
527 | \endlist | - |
528 | | - |
529 | \sa arguments() | - |
530 | */ | - |
531 | | - |
532 | #ifdef Q_QDOC | - |
533 | QApplication::QApplication(int &argc, char **argv) | - |
534 | #else | - |
535 | QApplication::QApplication(int &argc, char **argv, int _internal) | - |
536 | #endif | - |
537 | : QGuiApplication(*new QApplicationPrivate(argc, argv, _internal)) | - |
538 | { Q_D(QApplication); d->construct(); } executed: } Execution Count:215 | 215 |
539 | | - |
540 | /*! | - |
541 | \internal | - |
542 | */ | - |
543 | void QApplicationPrivate::construct() | - |
544 | { | - |
545 | initResources(); executed (the execution status of this line is deduced): initResources(); | - |
546 | | - |
547 | qt_is_gui_used = (application_type != QApplicationPrivate::Tty); executed (the execution status of this line is deduced): qt_is_gui_used = (application_type != QApplicationPrivate::Tty); | - |
548 | process_cmdline(); executed (the execution status of this line is deduced): process_cmdline(); | - |
549 | | - |
550 | // Must be called before initialize() | - |
551 | qt_init(this, application_type); executed (the execution status of this line is deduced): qt_init(this, application_type); | - |
552 | initialize(); executed (the execution status of this line is deduced): initialize(); | - |
553 | eventDispatcher->startingUp(); executed (the execution status of this line is deduced): eventDispatcher->startingUp(); | - |
554 | | - |
555 | #ifdef QT_EVAL | - |
556 | extern void qt_gui_eval_init(uint); | - |
557 | qt_gui_eval_init(application_type); | - |
558 | #endif | - |
559 | | - |
560 | #ifndef QT_NO_LIBRARY | - |
561 | if(load_testability) { partially evaluated: load_testability no Evaluation Count:0 | yes Evaluation Count:215 |
| 0-215 |
562 | QLibrary testLib(QLatin1String("qttestability")); never executed (the execution status of this line is deduced): QLibrary testLib(QLatin1String("qttestability")); | - |
563 | if (testLib.load()) { never evaluated: testLib.load() | 0 |
564 | typedef void (*TasInitialize)(void); never executed (the execution status of this line is deduced): typedef void (*TasInitialize)(void); | - |
565 | TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init"); never executed (the execution status of this line is deduced): TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init"); | - |
566 | if (initFunction) { never evaluated: initFunction | 0 |
567 | initFunction(); never executed (the execution status of this line is deduced): initFunction(); | - |
568 | } else { | 0 |
569 | qCritical("Library qttestability resolve failed!"); never executed (the execution status of this line is deduced): QMessageLogger("kernel/qapplication.cpp", 569, __PRETTY_FUNCTION__).critical("Library qttestability resolve failed!"); | - |
570 | } | 0 |
571 | } else { | - |
572 | qCritical("Library qttestability load failed!"); never executed (the execution status of this line is deduced): QMessageLogger("kernel/qapplication.cpp", 572, __PRETTY_FUNCTION__).critical("Library qttestability load failed!"); | - |
573 | } | 0 |
574 | } | - |
575 | #endif | - |
576 | } executed: } Execution Count:215 | 215 |
577 | | - |
578 | #ifndef QT_NO_STATEMACHINE | - |
579 | void qRegisterGuiStateMachine(); | - |
580 | void qUnregisterGuiStateMachine(); | - |
581 | #endif | - |
582 | extern void qRegisterWidgetsVariant(); | - |
583 | | - |
584 | /*! | - |
585 | \fn void QApplicationPrivate::initialize() | - |
586 | | - |
587 | Initializes the QApplication object, called from the constructors. | - |
588 | */ | - |
589 | void QApplicationPrivate::initialize() | - |
590 | { | - |
591 | QWidgetPrivate::mapper = new QWidgetMapper; executed (the execution status of this line is deduced): QWidgetPrivate::mapper = new QWidgetMapper; | - |
592 | QWidgetPrivate::allWidgets = new QWidgetSet; executed (the execution status of this line is deduced): QWidgetPrivate::allWidgets = new QWidgetSet; | - |
593 | | - |
594 | // needed for a static build. | - |
595 | qRegisterWidgetsVariant(); executed (the execution status of this line is deduced): qRegisterWidgetsVariant(); | - |
596 | | - |
597 | if (application_type != QApplicationPrivate::Tty) partially evaluated: application_type != QApplicationPrivate::Tty yes Evaluation Count:215 | no Evaluation Count:0 |
| 0-215 |
598 | (void) QApplication::style(); // trigger creation of application style executed: (void) QApplication::style(); Execution Count:215 | 215 |
599 | #ifndef QT_NO_STATEMACHINE | - |
600 | // trigger registering of QStateMachine's GUI types | - |
601 | qRegisterGuiStateMachine(); executed (the execution status of this line is deduced): qRegisterGuiStateMachine(); | - |
602 | #endif | - |
603 | | - |
604 | is_app_running = true; // no longer starting up executed (the execution status of this line is deduced): is_app_running = true; | - |
605 | | - |
606 | Q_Q(QApplication); executed (the execution status of this line is deduced): QApplication * const q = q_func(); | - |
607 | | - |
608 | if (qgetenv("QT_USE_NATIVE_WINDOWS").toInt() > 0) partially evaluated: qgetenv("QT_USE_NATIVE_WINDOWS").toInt() > 0 no Evaluation Count:0 | yes Evaluation Count:215 |
| 0-215 |
609 | q->setAttribute(Qt::AA_NativeWindows); never executed: q->setAttribute(Qt::AA_NativeWindows); | 0 |
610 | | - |
611 | #ifdef Q_OS_WINCE | - |
612 | #ifdef QT_AUTO_MAXIMIZE_THRESHOLD | - |
613 | autoMaximizeThreshold = QT_AUTO_MAXIMIZE_THRESHOLD; | - |
614 | #else | - |
615 | if (qt_wince_is_mobile()) | - |
616 | autoMaximizeThreshold = 50; | - |
617 | else | - |
618 | autoMaximizeThreshold = -1; | - |
619 | #endif //QT_AUTO_MAXIMIZE_THRESHOLD | - |
620 | #endif //Q_OS_WINCE | - |
621 | | - |
622 | #ifndef QT_NO_WHEELEVENT | - |
623 | QApplicationPrivate::wheel_scroll_lines = 3; executed (the execution status of this line is deduced): QApplicationPrivate::wheel_scroll_lines = 3; | - |
624 | #endif | - |
625 | | - |
626 | if (qt_is_gui_used) partially evaluated: qt_is_gui_used yes Evaluation Count:215 | no Evaluation Count:0 |
| 0-215 |
627 | initializeMultitouch(); executed: initializeMultitouch(); Execution Count:215 | 215 |
628 | | - |
629 | if (QApplication::desktopSettingsAware()) partially evaluated: QApplication::desktopSettingsAware() yes Evaluation Count:215 | no Evaluation Count:0 |
| 0-215 |
630 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) partially evaluated: const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme() yes Evaluation Count:215 | no Evaluation Count:0 |
| 0-215 |
631 | QApplicationPrivate::enabledAnimations = theme->themeHint(QPlatformTheme::UiEffects).toInt(); executed: QApplicationPrivate::enabledAnimations = theme->themeHint(QPlatformTheme::UiEffects).toInt(); Execution Count:215 | 215 |
632 | } executed: } Execution Count:215 | 215 |
633 | | - |
634 | /***************************************************************************** | - |
635 | Functions returning the active popup and modal widgets. | - |
636 | *****************************************************************************/ | - |
637 | | - |
638 | /*! | - |
639 | Returns the active popup widget. | - |
640 | | - |
641 | A popup widget is a special top-level widget that sets the \c | - |
642 | Qt::WType_Popup widget flag, e.g. the QMenu widget. When the application | - |
643 | opens a popup widget, all events are sent to the popup. Normal widgets and | - |
644 | modal widgets cannot be accessed before the popup widget is closed. | - |
645 | | - |
646 | Only other popup widgets may be opened when a popup widget is shown. The | - |
647 | popup widgets are organized in a stack. This function returns the active | - |
648 | popup widget at the top of the stack. | - |
649 | | - |
650 | \sa activeModalWidget(), topLevelWidgets() | - |
651 | */ | - |
652 | | - |
653 | QWidget *QApplication::activePopupWidget() | - |
654 | { | - |
655 | return QApplicationPrivate::popupWidgets && !QApplicationPrivate::popupWidgets->isEmpty() ? executed: return QApplicationPrivate::popupWidgets && !QApplicationPrivate::popupWidgets->isEmpty() ? QApplicationPrivate::popupWidgets->last() : 0; Execution Count:7209 | 7209 |
656 | QApplicationPrivate::popupWidgets->last() : 0; executed: return QApplicationPrivate::popupWidgets && !QApplicationPrivate::popupWidgets->isEmpty() ? QApplicationPrivate::popupWidgets->last() : 0; Execution Count:7209 | 7209 |
657 | } | - |
658 | | - |
659 | | - |
660 | /*! | - |
661 | Returns the active modal widget. | - |
662 | | - |
663 | A modal widget is a special top-level widget which is a subclass of QDialog | - |
664 | that specifies the modal parameter of the constructor as true. A modal | - |
665 | widget must be closed before the user can continue with other parts of the | - |
666 | program. | - |
667 | | - |
668 | Modal widgets are organized in a stack. This function returns the active | - |
669 | modal widget at the top of the stack. | - |
670 | | - |
671 | \sa activePopupWidget(), topLevelWidgets() | - |
672 | */ | - |
673 | | - |
674 | QWidget *QApplication::activeModalWidget() | - |
675 | { | - |
676 | QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(modalWindow()); executed (the execution status of this line is deduced): QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(modalWindow()); | - |
677 | return widgetWindow ? widgetWindow->widget() : 0; executed: return widgetWindow ? widgetWindow->widget() : 0; Execution Count:4182 | 4182 |
678 | } | - |
679 | | - |
680 | /*! | - |
681 | Cleans up any window system resources that were allocated by this | - |
682 | application. Sets the global variable \c qApp to 0. | - |
683 | */ | - |
684 | | - |
685 | QApplication::~QApplication() | - |
686 | { | - |
687 | Q_D(QApplication); executed (the execution status of this line is deduced): QApplicationPrivate * const d = d_func(); | - |
688 | | - |
689 | //### this should probable be done even later | - |
690 | qt_call_post_routines(); executed (the execution status of this line is deduced): qt_call_post_routines(); | - |
691 | | - |
692 | // kill timers before closing down the dispatcher | - |
693 | d->toolTipWakeUp.stop(); executed (the execution status of this line is deduced): d->toolTipWakeUp.stop(); | - |
694 | d->toolTipFallAsleep.stop(); executed (the execution status of this line is deduced): d->toolTipFallAsleep.stop(); | - |
695 | | - |
696 | QApplicationPrivate::is_app_closing = true; executed (the execution status of this line is deduced): QApplicationPrivate::is_app_closing = true; | - |
697 | QApplicationPrivate::is_app_running = false; executed (the execution status of this line is deduced): QApplicationPrivate::is_app_running = false; | - |
698 | | - |
699 | delete QWidgetPrivate::mapper; executed (the execution status of this line is deduced): delete QWidgetPrivate::mapper; | - |
700 | QWidgetPrivate::mapper = 0; executed (the execution status of this line is deduced): QWidgetPrivate::mapper = 0; | - |
701 | | - |
702 | // delete all widgets | - |
703 | if (QWidgetPrivate::allWidgets) { partially evaluated: QWidgetPrivate::allWidgets yes Evaluation Count:213 | no Evaluation Count:0 |
| 0-213 |
704 | QWidgetSet *mySet = QWidgetPrivate::allWidgets; executed (the execution status of this line is deduced): QWidgetSet *mySet = QWidgetPrivate::allWidgets; | - |
705 | QWidgetPrivate::allWidgets = 0; executed (the execution status of this line is deduced): QWidgetPrivate::allWidgets = 0; | - |
706 | for (QWidgetSet::ConstIterator it = mySet->constBegin(); it != mySet->constEnd(); ++it) { evaluated: it != mySet->constEnd() yes Evaluation Count:4292 | yes Evaluation Count:213 |
| 213-4292 |
707 | register QWidget *w = *it; executed (the execution status of this line is deduced): register QWidget *w = *it; | - |
708 | if (!w->parent()) // window evaluated: !w->parent() yes Evaluation Count:585 | yes Evaluation Count:3707 |
| 585-3707 |
709 | w->destroy(true, true); executed: w->destroy(true, true); Execution Count:585 | 585 |
710 | } executed: } Execution Count:4292 | 4292 |
711 | delete mySet; executed (the execution status of this line is deduced): delete mySet; | - |
712 | } executed: } Execution Count:213 | 213 |
713 | | - |
714 | delete qt_desktopWidget; executed (the execution status of this line is deduced): delete qt_desktopWidget; | - |
715 | qt_desktopWidget = 0; executed (the execution status of this line is deduced): qt_desktopWidget = 0; | - |
716 | | - |
717 | delete QApplicationPrivate::app_pal; executed (the execution status of this line is deduced): delete QApplicationPrivate::app_pal; | - |
718 | QApplicationPrivate::app_pal = 0; executed (the execution status of this line is deduced): QApplicationPrivate::app_pal = 0; | - |
719 | clearSystemPalette(); executed (the execution status of this line is deduced): clearSystemPalette(); | - |
720 | delete QApplicationPrivate::set_pal; executed (the execution status of this line is deduced): delete QApplicationPrivate::set_pal; | - |
721 | QApplicationPrivate::set_pal = 0; executed (the execution status of this line is deduced): QApplicationPrivate::set_pal = 0; | - |
722 | app_palettes()->clear(); executed (the execution status of this line is deduced): app_palettes()->clear(); | - |
723 | | - |
724 | delete QApplicationPrivate::sys_font; executed (the execution status of this line is deduced): delete QApplicationPrivate::sys_font; | - |
725 | QApplicationPrivate::sys_font = 0; executed (the execution status of this line is deduced): QApplicationPrivate::sys_font = 0; | - |
726 | delete QApplicationPrivate::set_font; executed (the execution status of this line is deduced): delete QApplicationPrivate::set_font; | - |
727 | QApplicationPrivate::set_font = 0; executed (the execution status of this line is deduced): QApplicationPrivate::set_font = 0; | - |
728 | app_fonts()->clear(); executed (the execution status of this line is deduced): app_fonts()->clear(); | - |
729 | | - |
730 | delete QApplicationPrivate::app_style; executed (the execution status of this line is deduced): delete QApplicationPrivate::app_style; | - |
731 | QApplicationPrivate::app_style = 0; executed (the execution status of this line is deduced): QApplicationPrivate::app_style = 0; | - |
732 | delete QApplicationPrivate::app_icon; executed (the execution status of this line is deduced): delete QApplicationPrivate::app_icon; | - |
733 | QApplicationPrivate::app_icon = 0; executed (the execution status of this line is deduced): QApplicationPrivate::app_icon = 0; | - |
734 | | - |
735 | #ifndef QT_NO_DRAGANDDROP | - |
736 | if (qt_is_gui_used) partially evaluated: qt_is_gui_used yes Evaluation Count:213 | no Evaluation Count:0 |
| 0-213 |
737 | delete QDragManager::self(); executed: delete QDragManager::self(); Execution Count:213 | 213 |
738 | #endif | - |
739 | | - |
740 | d->cleanupMultitouch(); executed (the execution status of this line is deduced): d->cleanupMultitouch(); | - |
741 | | - |
742 | qt_cleanup(); executed (the execution status of this line is deduced): qt_cleanup(); | - |
743 | | - |
744 | if (QApplicationPrivate::widgetCount) partially evaluated: QApplicationPrivate::widgetCount no Evaluation Count:0 | yes Evaluation Count:213 |
| 0-213 |
745 | qDebug("Widgets left: %i Max widgets: %i \n", QWidgetPrivate::instanceCounter, QWidgetPrivate::maxInstances); never executed: QMessageLogger("kernel/qapplication.cpp", 745, __PRETTY_FUNCTION__).debug("Widgets left: %i Max widgets: %i \n", QWidgetPrivate::instanceCounter, QWidgetPrivate::maxInstances); | 0 |
746 | | - |
747 | QApplicationPrivate::obey_desktop_settings = true; executed (the execution status of this line is deduced): QApplicationPrivate::obey_desktop_settings = true; | - |
748 | | - |
749 | QApplicationPrivate::app_strut = QSize(0, 0); executed (the execution status of this line is deduced): QApplicationPrivate::app_strut = QSize(0, 0); | - |
750 | QApplicationPrivate::enabledAnimations = QPlatformTheme::GeneralUiEffect; executed (the execution status of this line is deduced): QApplicationPrivate::enabledAnimations = QPlatformTheme::GeneralUiEffect; | - |
751 | QApplicationPrivate::widgetCount = false; executed (the execution status of this line is deduced): QApplicationPrivate::widgetCount = false; | - |
752 | | - |
753 | #ifndef QT_NO_STATEMACHINE | - |
754 | // trigger unregistering of QStateMachine's GUI types | - |
755 | qUnregisterGuiStateMachine(); executed (the execution status of this line is deduced): qUnregisterGuiStateMachine(); | - |
756 | #endif | - |
757 | } executed: } Execution Count:213 | 213 |
758 | | - |
759 | | - |
760 | /*! | - |
761 | \fn QWidget *QApplication::widgetAt(const QPoint &point) | - |
762 | | - |
763 | Returns the widget at global screen position \a point, or 0 if there is no | - |
764 | Qt widget there. | - |
765 | | - |
766 | This function can be slow. | - |
767 | | - |
768 | \sa QCursor::pos(), QWidget::grabMouse(), QWidget::grabKeyboard() | - |
769 | */ | - |
770 | QWidget *QApplication::widgetAt(const QPoint &p) | - |
771 | { | - |
772 | QWidget *window = QApplication::topLevelAt(p); executed (the execution status of this line is deduced): QWidget *window = QApplication::topLevelAt(p); | - |
773 | if (!window) partially evaluated: !window no Evaluation Count:0 | yes Evaluation Count:111 |
| 0-111 |
774 | return 0; never executed: return 0; | 0 |
775 | | - |
776 | QWidget *child = 0; executed (the execution status of this line is deduced): QWidget *child = 0; | - |
777 | | - |
778 | if (!window->testAttribute(Qt::WA_TransparentForMouseEvents)) partially evaluated: !window->testAttribute(Qt::WA_TransparentForMouseEvents) yes Evaluation Count:111 | no Evaluation Count:0 |
| 0-111 |
779 | child = window->childAt(window->mapFromGlobal(p)); executed: child = window->childAt(window->mapFromGlobal(p)); Execution Count:111 | 111 |
780 | | - |
781 | if (child) partially evaluated: child no Evaluation Count:0 | yes Evaluation Count:111 |
| 0-111 |
782 | return child; never executed: return child; | 0 |
783 | | - |
784 | if (window->testAttribute(Qt::WA_TransparentForMouseEvents)) { partially evaluated: window->testAttribute(Qt::WA_TransparentForMouseEvents) no Evaluation Count:0 | yes Evaluation Count:111 |
| 0-111 |
785 | //shoot a hole in the widget and try once again, | - |
786 | //suboptimal on Qt for Embedded Linux where we do | - |
787 | //know the stacking order of the toplevels. | - |
788 | int x = p.x(); never executed (the execution status of this line is deduced): int x = p.x(); | - |
789 | int y = p.y(); never executed (the execution status of this line is deduced): int y = p.y(); | - |
790 | QRegion oldmask = window->mask(); never executed (the execution status of this line is deduced): QRegion oldmask = window->mask(); | - |
791 | QPoint wpoint = window->mapFromGlobal(QPoint(x, y)); never executed (the execution status of this line is deduced): QPoint wpoint = window->mapFromGlobal(QPoint(x, y)); | - |
792 | QRegion newmask = (oldmask.isEmpty() ? QRegion(window->rect()) : oldmask) never evaluated: oldmask.isEmpty() | 0 |
793 | - QRegion(wpoint.x(), wpoint.y(), 1, 1); never executed (the execution status of this line is deduced): - QRegion(wpoint.x(), wpoint.y(), 1, 1); | - |
794 | window->setMask(newmask); never executed (the execution status of this line is deduced): window->setMask(newmask); | - |
795 | QWidget *recurse = 0; never executed (the execution status of this line is deduced): QWidget *recurse = 0; | - |
796 | if (QApplication::topLevelAt(p) != window) // verify recursion will terminate never evaluated: QApplication::topLevelAt(p) != window | 0 |
797 | recurse = widgetAt(x, y); never executed: recurse = widgetAt(x, y); | 0 |
798 | if (oldmask.isEmpty()) never evaluated: oldmask.isEmpty() | 0 |
799 | window->clearMask(); never executed: window->clearMask(); | 0 |
800 | else | - |
801 | window->setMask(oldmask); never executed: window->setMask(oldmask); | 0 |
802 | return recurse; never executed: return recurse; | 0 |
803 | } | - |
804 | return window; executed: return window; Execution Count:111 | 111 |
805 | } | - |
806 | | - |
807 | /*! | - |
808 | \fn QWidget *QApplication::widgetAt(int x, int y) | - |
809 | | - |
810 | \overload | - |
811 | | - |
812 | Returns the widget at global screen position (\a x, \a y), or 0 if there is | - |
813 | no Qt widget there. | - |
814 | */ | - |
815 | | - |
816 | /*! | - |
817 | \internal | - |
818 | */ | - |
819 | bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents) | - |
820 | { | - |
821 | if ((event->type() == QEvent::UpdateRequest evaluated: event->type() == QEvent::UpdateRequest yes Evaluation Count:5607 | yes Evaluation Count:36831 |
| 5607-36831 |
822 | || event->type() == QEvent::LayoutRequest evaluated: event->type() == QEvent::LayoutRequest yes Evaluation Count:18208 | yes Evaluation Count:18623 |
| 18208-18623 |
823 | || event->type() == QEvent::Resize partially evaluated: event->type() == QEvent::Resize no Evaluation Count:0 | yes Evaluation Count:18623 |
| 0-18623 |
824 | || event->type() == QEvent::Move partially evaluated: event->type() == QEvent::Move no Evaluation Count:0 | yes Evaluation Count:18623 |
| 0-18623 |
825 | || event->type() == QEvent::LanguageChange evaluated: event->type() == QEvent::LanguageChange yes Evaluation Count:1 | yes Evaluation Count:18622 |
| 1-18622 |
826 | || event->type() == QEvent::InputMethod)) { partially evaluated: event->type() == QEvent::InputMethod no Evaluation Count:0 | yes Evaluation Count:18622 |
| 0-18622 |
827 | for (QPostEventList::const_iterator it = postedEvents->constBegin(); it != postedEvents->constEnd(); ++it) { evaluated: it != postedEvents->constEnd() yes Evaluation Count:4065903 | yes Evaluation Count:16521 |
| 16521-4065903 |
828 | const QPostEvent &cur = *it; executed (the execution status of this line is deduced): const QPostEvent &cur = *it; | - |
829 | if (cur.receiver != receiver || cur.event == 0 || cur.event->type() != event->type()) evaluated: cur.receiver != receiver yes Evaluation Count:4028100 | yes Evaluation Count:37803 |
evaluated: cur.event == 0 yes Evaluation Count:1923 | yes Evaluation Count:35880 |
evaluated: cur.event->type() != event->type() yes Evaluation Count:28585 | yes Evaluation Count:7295 |
| 1923-4028100 |
830 | continue; executed: continue; Execution Count:4058608 | 4058608 |
831 | if (cur.event->type() == QEvent::LayoutRequest evaluated: cur.event->type() == QEvent::LayoutRequest yes Evaluation Count:4542 | yes Evaluation Count:2753 |
| 2753-4542 |
832 | || cur.event->type() == QEvent::UpdateRequest) { partially evaluated: cur.event->type() == QEvent::UpdateRequest yes Evaluation Count:2753 | no Evaluation Count:0 |
| 0-2753 |
833 | ; | - |
834 | } else if (cur.event->type() == QEvent::Resize) { executed: } Execution Count:7295 never evaluated: cur.event->type() == QEvent::Resize | 0-7295 |
835 | ((QResizeEvent *)(cur.event))->s = ((QResizeEvent *)event)->s; never executed (the execution status of this line is deduced): ((QResizeEvent *)(cur.event))->s = ((QResizeEvent *)event)->s; | - |
836 | } else if (cur.event->type() == QEvent::Move) { never executed: } never evaluated: cur.event->type() == QEvent::Move | 0 |
837 | ((QMoveEvent *)(cur.event))->p = ((QMoveEvent *)event)->p; never executed (the execution status of this line is deduced): ((QMoveEvent *)(cur.event))->p = ((QMoveEvent *)event)->p; | - |
838 | } else if (cur.event->type() == QEvent::LanguageChange) { never executed: } never evaluated: cur.event->type() == QEvent::LanguageChange | 0 |
839 | ; | - |
840 | } else if ( cur.event->type() == QEvent::InputMethod ) { never executed: } never evaluated: cur.event->type() == QEvent::InputMethod | 0 |
841 | *(QInputMethodEvent *)(cur.event) = *(QInputMethodEvent *)event; never executed (the execution status of this line is deduced): *(QInputMethodEvent *)(cur.event) = *(QInputMethodEvent *)event; | - |
842 | } else { | 0 |
843 | continue; never executed: continue; | 0 |
844 | } | - |
845 | delete event; executed (the execution status of this line is deduced): delete event; | - |
846 | return true; executed: return true; Execution Count:7295 | 7295 |
847 | } | - |
848 | return false; executed: return false; Execution Count:16521 | 16521 |
849 | } | - |
850 | return QGuiApplication::compressEvent(event, receiver, postedEvents); executed: return QGuiApplication::compressEvent(event, receiver, postedEvents); Execution Count:18622 | 18622 |
851 | } | - |
852 | | - |
853 | /*! | - |
854 | \property QApplication::styleSheet | - |
855 | \brief the application style sheet | - |
856 | \since 4.2 | - |
857 | | - |
858 | By default, this property returns an empty string unless the user specifies | - |
859 | the \c{-stylesheet} option on the command line when running the application. | - |
860 | | - |
861 | \sa QWidget::setStyle(), {Qt Style Sheets} | - |
862 | */ | - |
863 | | - |
864 | /*! | - |
865 | \property QApplication::autoMaximizeThreshold | - |
866 | \since 4.4 | - |
867 | \brief defines a threshold for auto maximizing widgets | - |
868 | | - |
869 | \b{The auto maximize threshold is only available as part of Qt for | - |
870 | Windows CE.} | - |
871 | | - |
872 | This property defines a threshold for the size of a window as a percentage | - |
873 | of the screen size. If the minimum size hint of a window exceeds the | - |
874 | threshold, calling show() will cause the window to be maximized | - |
875 | automatically. | - |
876 | | - |
877 | Setting the threshold to 100 or greater means that the widget will always | - |
878 | be maximized. Alternatively, setting the threshold to 50 means that the | - |
879 | widget will be maximized only if the vertical minimum size hint is at least | - |
880 | 50% of the vertical screen size. | - |
881 | | - |
882 | Setting the threshold to -1 disables the feature. | - |
883 | | - |
884 | On Windows CE the default is -1 (i.e., it is disabled). | - |
885 | On Windows Mobile the default is 40. | - |
886 | */ | - |
887 | | - |
888 | /*! | - |
889 | \property QApplication::autoSipEnabled | - |
890 | \since 4.5 | - |
891 | \brief toggles automatic SIP (software input panel) visibility | - |
892 | | - |
893 | Set this property to \c true to automatically display the SIP when entering | - |
894 | widgets that accept keyboard input. This property only affects widgets with | - |
895 | the WA_InputMethodEnabled attribute set, and is typically used to launch | - |
896 | a virtual keyboard on devices which have very few or no keys. | - |
897 | | - |
898 | \b{ The property only has an effect on platforms which use software input | - |
899 | panels, such as Windows CE.} | - |
900 | | - |
901 | The default is platform dependent. | - |
902 | */ | - |
903 | | - |
904 | #ifdef Q_OS_WINCE | - |
905 | void QApplication::setAutoMaximizeThreshold(const int threshold) | - |
906 | { | - |
907 | QApplicationPrivate::autoMaximizeThreshold = threshold; | - |
908 | } | - |
909 | | - |
910 | int QApplication::autoMaximizeThreshold() const | - |
911 | { | - |
912 | return QApplicationPrivate::autoMaximizeThreshold; | - |
913 | } | - |
914 | #endif | - |
915 | | - |
916 | void QApplication::setAutoSipEnabled(const bool enabled) | - |
917 | { | - |
918 | QApplicationPrivate::autoSipEnabled = enabled; never executed (the execution status of this line is deduced): QApplicationPrivate::autoSipEnabled = enabled; | - |
919 | } | 0 |
920 | | - |
921 | bool QApplication::autoSipEnabled() const | - |
922 | { | - |
923 | return QApplicationPrivate::autoSipEnabled; executed: return QApplicationPrivate::autoSipEnabled; Execution Count:10 | 10 |
924 | } | - |
925 | | - |
926 | #ifndef QT_NO_STYLE_STYLESHEET | - |
927 | | - |
928 | QString QApplication::styleSheet() const | - |
929 | { | - |
930 | return QApplicationPrivate::styleSheet; executed: return QApplicationPrivate::styleSheet; Execution Count:46368 | 46368 |
931 | } | - |
932 | | - |
933 | void QApplication::setStyleSheet(const QString& styleSheet) | - |
934 | { | - |
935 | QApplicationPrivate::styleSheet = styleSheet; executed (the execution status of this line is deduced): QApplicationPrivate::styleSheet = styleSheet; | - |
936 | QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle*>(QApplicationPrivate::app_style); executed (the execution status of this line is deduced): QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle*>(QApplicationPrivate::app_style); | - |
937 | if (styleSheet.isEmpty()) { // application style sheet removed evaluated: styleSheet.isEmpty() yes Evaluation Count:2 | yes Evaluation Count:3 |
| 2-3 |
938 | if (!proxy) partially evaluated: !proxy no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
939 | return; // there was no stylesheet before | 0 |
940 | setStyle(proxy->base); executed (the execution status of this line is deduced): setStyle(proxy->base); | - |
941 | } else if (proxy) { // style sheet update, just repolish executed: } Execution Count:2 partially evaluated: proxy no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
942 | proxy->repolish(qApp); never executed (the execution status of this line is deduced): proxy->repolish((static_cast<QApplication *>(QCoreApplication::instance()))); | - |
943 | } else { // stylesheet set the first time | 0 |
944 | QStyleSheetStyle *newProxy = new QStyleSheetStyle(QApplicationPrivate::app_style); executed (the execution status of this line is deduced): QStyleSheetStyle *newProxy = new QStyleSheetStyle(QApplicationPrivate::app_style); | - |
945 | QApplicationPrivate::app_style->setParent(newProxy); executed (the execution status of this line is deduced): QApplicationPrivate::app_style->setParent(newProxy); | - |
946 | setStyle(newProxy); executed (the execution status of this line is deduced): setStyle(newProxy); | - |
947 | } executed: } Execution Count:3 | 3 |
948 | } | - |
949 | | - |
950 | #endif // QT_NO_STYLE_STYLESHEET | - |
951 | | - |
952 | /*! | - |
953 | Returns the application's style object. | - |
954 | | - |
955 | \sa setStyle(), QStyle | - |
956 | */ | - |
957 | QStyle *QApplication::style() | - |
958 | { | - |
959 | if (QApplicationPrivate::app_style) evaluated: QApplicationPrivate::app_style yes Evaluation Count:1508584 | yes Evaluation Count:214 |
| 214-1508584 |
960 | return QApplicationPrivate::app_style; executed: return QApplicationPrivate::app_style; Execution Count:1508584 | 1508584 |
961 | if (!qobject_cast<QApplication *>(QCoreApplication::instance())) { partially evaluated: !qobject_cast<QApplication *>(QCoreApplication::instance()) no Evaluation Count:0 | yes Evaluation Count:214 |
| 0-214 |
962 | Q_ASSERT(!"No style available without QApplication!"); never executed (the execution status of this line is deduced): qt_noop(); | - |
963 | return 0; never executed: return 0; | 0 |
964 | } | - |
965 | | - |
966 | if (!QApplicationPrivate::app_style) { partially evaluated: !QApplicationPrivate::app_style yes Evaluation Count:214 | no Evaluation Count:0 |
| 0-214 |
967 | // Compile-time search for default style | - |
968 | // | - |
969 | QString style; executed (the execution status of this line is deduced): QString style; | - |
970 | #ifdef QT_BUILD_INTERNAL | - |
971 | QString envStyle = QString::fromLocal8Bit(qgetenv("QT_STYLE_OVERRIDE")); | - |
972 | #else | - |
973 | QString envStyle; executed (the execution status of this line is deduced): QString envStyle; | - |
974 | #endif | - |
975 | if (!QApplicationPrivate::styleOverride.isEmpty()) { evaluated: !QApplicationPrivate::styleOverride.isEmpty() yes Evaluation Count:2 | yes Evaluation Count:212 |
| 2-212 |
976 | style = QApplicationPrivate::styleOverride; executed (the execution status of this line is deduced): style = QApplicationPrivate::styleOverride; | - |
977 | } else if (!envStyle.isEmpty()) { executed: } Execution Count:2 partially evaluated: !envStyle.isEmpty() no Evaluation Count:0 | yes Evaluation Count:212 |
| 0-212 |
978 | style = envStyle; never executed (the execution status of this line is deduced): style = envStyle; | - |
979 | } else { | 0 |
980 | style = QApplicationPrivate::desktopStyleKey(); executed (the execution status of this line is deduced): style = QApplicationPrivate::desktopStyleKey(); | - |
981 | } executed: } Execution Count:212 | 212 |
982 | | - |
983 | QStyle *&app_style = QApplicationPrivate::app_style; executed (the execution status of this line is deduced): QStyle *&app_style = QApplicationPrivate::app_style; | - |
984 | app_style = QStyleFactory::create(style); executed (the execution status of this line is deduced): app_style = QStyleFactory::create(style); | - |
985 | if (!app_style) { partially evaluated: !app_style no Evaluation Count:0 | yes Evaluation Count:214 |
| 0-214 |
986 | QStringList styles = QStyleFactory::keys(); never executed (the execution status of this line is deduced): QStringList styles = QStyleFactory::keys(); | - |
987 | for (int i = 0; i < styles.size(); ++i) { never evaluated: i < styles.size() | 0 |
988 | if ((app_style = QStyleFactory::create(styles.at(i)))) never evaluated: (app_style = QStyleFactory::create(styles.at(i))) | 0 |
989 | break; | 0 |
990 | } | 0 |
991 | } | 0 |
992 | if (!app_style) { partially evaluated: !app_style no Evaluation Count:0 | yes Evaluation Count:214 |
| 0-214 |
993 | Q_ASSERT(!"No styles available!"); never executed (the execution status of this line is deduced): qt_noop(); | - |
994 | return 0; never executed: return 0; | 0 |
995 | } | - |
996 | } executed: } Execution Count:214 | 214 |
997 | // take ownership of the style | - |
998 | QApplicationPrivate::app_style->setParent(qApp); executed (the execution status of this line is deduced): QApplicationPrivate::app_style->setParent((static_cast<QApplication *>(QCoreApplication::instance()))); | - |
999 | | - |
1000 | initSystemPalette(); executed (the execution status of this line is deduced): initSystemPalette(); | - |
1001 | | - |
1002 | if (QApplicationPrivate::set_pal) // repolish set palette with the new style partially evaluated: QApplicationPrivate::set_pal no Evaluation Count:0 | yes Evaluation Count:214 |
| 0-214 |
1003 | QApplication::setPalette(*QApplicationPrivate::set_pal); never executed: QApplication::setPalette(*QApplicationPrivate::set_pal); | 0 |
1004 | | - |
1005 | #ifndef QT_NO_STYLE_STYLESHEET | - |
1006 | if (!QApplicationPrivate::styleSheet.isEmpty()) { partially evaluated: !QApplicationPrivate::styleSheet.isEmpty() no Evaluation Count:0 | yes Evaluation Count:214 |
| 0-214 |
1007 | qApp->setStyleSheet(QApplicationPrivate::styleSheet); never executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->setStyleSheet(QApplicationPrivate::styleSheet); | - |
1008 | } else | 0 |
1009 | #endif | - |
1010 | QApplicationPrivate::app_style->polish(qApp); executed: QApplicationPrivate::app_style->polish((static_cast<QApplication *>(QCoreApplication::instance()))); Execution Count:214 | 214 |
1011 | | - |
1012 | return QApplicationPrivate::app_style; executed: return QApplicationPrivate::app_style; Execution Count:214 | 214 |
1013 | } | - |
1014 | | - |
1015 | /*! | - |
1016 | Sets the application's GUI style to \a style. Ownership of the style object | - |
1017 | is transferred to QApplication, so QApplication will delete the style | - |
1018 | object on application exit or when a new style is set and the old style is | - |
1019 | still the parent of the application object. | - |
1020 | | - |
1021 | Example usage: | - |
1022 | \snippet code/src_gui_kernel_qapplication.cpp 1 | - |
1023 | | - |
1024 | When switching application styles, the color palette is set back to the | - |
1025 | initial colors or the system defaults. This is necessary since certain | - |
1026 | styles have to adapt the color palette to be fully style-guide compliant. | - |
1027 | | - |
1028 | Setting the style before a palette has been set, i.e., before creating | - |
1029 | QApplication, will cause the application to use QStyle::standardPalette() | - |
1030 | for the palette. | - |
1031 | | - |
1032 | \warning Qt style sheets are currently not supported for custom QStyle | - |
1033 | subclasses. We plan to address this in some future release. | - |
1034 | | - |
1035 | \sa style(), QStyle, setPalette(), desktopSettingsAware() | - |
1036 | */ | - |
1037 | void QApplication::setStyle(QStyle *style) | - |
1038 | { | - |
1039 | if (!style || style == QApplicationPrivate::app_style) partially evaluated: !style no Evaluation Count:0 | yes Evaluation Count:96 |
evaluated: style == QApplicationPrivate::app_style yes Evaluation Count:31 | yes Evaluation Count:65 |
| 0-96 |
1040 | return; executed: return; Execution Count:31 | 31 |
1041 | | - |
1042 | QWidgetList all = allWidgets(); executed (the execution status of this line is deduced): QWidgetList all = allWidgets(); | - |
1043 | | - |
1044 | // clean up the old style | - |
1045 | if (QApplicationPrivate::app_style) { evaluated: QApplicationPrivate::app_style yes Evaluation Count:64 | yes Evaluation Count:1 |
| 1-64 |
1046 | if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { partially evaluated: QApplicationPrivate::is_app_running yes Evaluation Count:64 | no Evaluation Count:0 |
partially evaluated: !QApplicationPrivate::is_app_closing yes Evaluation Count:64 | no Evaluation Count:0 |
| 0-64 |
1047 | for (QWidgetList::ConstIterator it = all.constBegin(); it != all.constEnd(); ++it) { evaluated: it != all.constEnd() yes Evaluation Count:3239 | yes Evaluation Count:64 |
| 64-3239 |
1048 | register QWidget *w = *it; executed (the execution status of this line is deduced): register QWidget *w = *it; | - |
1049 | if (!(w->windowType() == Qt::Desktop) && // except desktop evaluated: !(w->windowType() == Qt::Desktop) yes Evaluation Count:3117 | yes Evaluation Count:122 |
| 122-3117 |
1050 | w->testAttribute(Qt::WA_WState_Polished)) { // has been polished evaluated: w->testAttribute(Qt::WA_WState_Polished) yes Evaluation Count:2958 | yes Evaluation Count:159 |
| 159-2958 |
1051 | QApplicationPrivate::app_style->unpolish(w); executed (the execution status of this line is deduced): QApplicationPrivate::app_style->unpolish(w); | - |
1052 | } executed: } Execution Count:2958 | 2958 |
1053 | } executed: } Execution Count:3239 | 3239 |
1054 | } executed: } Execution Count:64 | 64 |
1055 | QApplicationPrivate::app_style->unpolish(qApp); executed (the execution status of this line is deduced): QApplicationPrivate::app_style->unpolish((static_cast<QApplication *>(QCoreApplication::instance()))); | - |
1056 | } executed: } Execution Count:64 | 64 |
1057 | | - |
1058 | QStyle *old = QApplicationPrivate::app_style; // save executed (the execution status of this line is deduced): QStyle *old = QApplicationPrivate::app_style; | - |
1059 | | - |
1060 | #ifndef QT_NO_STYLE_STYLESHEET | - |
1061 | if (!QApplicationPrivate::styleSheet.isEmpty() && !qobject_cast<QStyleSheetStyle *>(style)) { evaluated: !QApplicationPrivate::styleSheet.isEmpty() yes Evaluation Count:3 | yes Evaluation Count:62 |
partially evaluated: !qobject_cast<QStyleSheetStyle *>(style) no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-62 |
1062 | // we have a stylesheet already and a new style is being set | - |
1063 | QStyleSheetStyle *newProxy = new QStyleSheetStyle(style); never executed (the execution status of this line is deduced): QStyleSheetStyle *newProxy = new QStyleSheetStyle(style); | - |
1064 | style->setParent(newProxy); never executed (the execution status of this line is deduced): style->setParent(newProxy); | - |
1065 | QApplicationPrivate::app_style = newProxy; never executed (the execution status of this line is deduced): QApplicationPrivate::app_style = newProxy; | - |
1066 | } else | 0 |
1067 | #endif // QT_NO_STYLE_STYLESHEET | - |
1068 | QApplicationPrivate::app_style = style; executed: QApplicationPrivate::app_style = style; Execution Count:65 | 65 |
1069 | QApplicationPrivate::app_style->setParent(qApp); // take ownership executed (the execution status of this line is deduced): QApplicationPrivate::app_style->setParent((static_cast<QApplication *>(QCoreApplication::instance()))); | - |
1070 | | - |
1071 | // take care of possible palette requirements of certain gui | - |
1072 | // styles. Do it before polishing the application since the style | - |
1073 | // might call QApplication::setPalette() itself | - |
1074 | if (QApplicationPrivate::set_pal) { partially evaluated: QApplicationPrivate::set_pal no Evaluation Count:0 | yes Evaluation Count:65 |
| 0-65 |
1075 | QApplication::setPalette(*QApplicationPrivate::set_pal); never executed (the execution status of this line is deduced): QApplication::setPalette(*QApplicationPrivate::set_pal); | - |
1076 | } else if (QApplicationPrivate::sys_pal) { never executed: } evaluated: QApplicationPrivate::sys_pal yes Evaluation Count:64 | yes Evaluation Count:1 |
| 0-64 |
1077 | QApplicationPrivate::initializeWidgetPaletteHash(); executed (the execution status of this line is deduced): QApplicationPrivate::initializeWidgetPaletteHash(); | - |
1078 | QApplicationPrivate::setPalette_helper(*QApplicationPrivate::sys_pal, /*className=*/0, /*clearWidgetPaletteHash=*/false); executed (the execution status of this line is deduced): QApplicationPrivate::setPalette_helper(*QApplicationPrivate::sys_pal, 0, false); | - |
1079 | } else if (!QApplicationPrivate::sys_pal) { executed: } Execution Count:64 partially evaluated: !QApplicationPrivate::sys_pal yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-64 |
1080 | // Initialize the sys_pal if it hasn't happened yet... | - |
1081 | QApplicationPrivate::setSystemPalette(QApplicationPrivate::app_style->standardPalette()); executed (the execution status of this line is deduced): QApplicationPrivate::setSystemPalette(QApplicationPrivate::app_style->standardPalette()); | - |
1082 | } executed: } Execution Count:1 | 1 |
1083 | | - |
1084 | // initialize the application with the new style | - |
1085 | QApplicationPrivate::app_style->polish(qApp); executed (the execution status of this line is deduced): QApplicationPrivate::app_style->polish((static_cast<QApplication *>(QCoreApplication::instance()))); | - |
1086 | | - |
1087 | // re-polish existing widgets if necessary | - |
1088 | if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { evaluated: QApplicationPrivate::is_app_running yes Evaluation Count:64 | yes Evaluation Count:1 |
partially evaluated: !QApplicationPrivate::is_app_closing yes Evaluation Count:64 | no Evaluation Count:0 |
| 0-64 |
1089 | for (QWidgetList::ConstIterator it1 = all.constBegin(); it1 != all.constEnd(); ++it1) { evaluated: it1 != all.constEnd() yes Evaluation Count:3239 | yes Evaluation Count:64 |
| 64-3239 |
1090 | register QWidget *w = *it1; executed (the execution status of this line is deduced): register QWidget *w = *it1; | - |
1091 | if (w->windowType() != Qt::Desktop && w->testAttribute(Qt::WA_WState_Polished)) { evaluated: w->windowType() != Qt::Desktop yes Evaluation Count:3117 | yes Evaluation Count:122 |
evaluated: w->testAttribute(Qt::WA_WState_Polished) yes Evaluation Count:2958 | yes Evaluation Count:159 |
| 122-3117 |
1092 | if (w->style() == QApplicationPrivate::app_style) partially evaluated: w->style() == QApplicationPrivate::app_style yes Evaluation Count:2958 | no Evaluation Count:0 |
| 0-2958 |
1093 | QApplicationPrivate::app_style->polish(w); // repolish executed: QApplicationPrivate::app_style->polish(w); Execution Count:2958 | 2958 |
1094 | #ifndef QT_NO_STYLE_STYLESHEET | - |
1095 | else | - |
1096 | w->setStyleSheet(w->styleSheet()); // touch never executed: w->setStyleSheet(w->styleSheet()); | 0 |
1097 | #endif | - |
1098 | } | - |
1099 | } executed: } Execution Count:3239 | 3239 |
1100 | | - |
1101 | for (QWidgetList::ConstIterator it2 = all.constBegin(); it2 != all.constEnd(); ++it2) { evaluated: it2 != all.constEnd() yes Evaluation Count:3239 | yes Evaluation Count:64 |
| 64-3239 |
1102 | register QWidget *w = *it2; executed (the execution status of this line is deduced): register QWidget *w = *it2; | - |
1103 | if (w->windowType() != Qt::Desktop && !w->testAttribute(Qt::WA_SetStyle)) { evaluated: w->windowType() != Qt::Desktop yes Evaluation Count:3117 | yes Evaluation Count:122 |
evaluated: !w->testAttribute(Qt::WA_SetStyle) yes Evaluation Count:3116 | yes Evaluation Count:1 |
| 1-3117 |
1104 | QEvent e(QEvent::StyleChange); executed (the execution status of this line is deduced): QEvent e(QEvent::StyleChange); | - |
1105 | QApplication::sendEvent(w, &e); executed (the execution status of this line is deduced): QApplication::sendEvent(w, &e); | - |
1106 | w->update(); executed (the execution status of this line is deduced): w->update(); | - |
1107 | } executed: } Execution Count:3116 | 3116 |
1108 | } executed: } Execution Count:3239 | 3239 |
1109 | } executed: } Execution Count:64 | 64 |
1110 | | - |
1111 | #ifndef QT_NO_STYLE_STYLESHEET | - |
1112 | if (QStyleSheetStyle *oldProxy = qobject_cast<QStyleSheetStyle *>(old)) { evaluated: QStyleSheetStyle *oldProxy = qobject_cast<QStyleSheetStyle *>(old) yes Evaluation Count:2 | yes Evaluation Count:63 |
| 2-63 |
1113 | oldProxy->deref(); executed (the execution status of this line is deduced): oldProxy->deref(); | - |
1114 | } else executed: } Execution Count:2 | 2 |
1115 | #endif | - |
1116 | if (old && old->parent() == qApp) { evaluated: old yes Evaluation Count:62 | yes Evaluation Count:1 |
evaluated: old->parent() == (static_cast<QApplication *>(QCoreApplication::instance())) yes Evaluation Count:59 | yes Evaluation Count:3 |
| 1-62 |
1117 | delete old; executed (the execution status of this line is deduced): delete old; | - |
1118 | } executed: } Execution Count:59 | 59 |
1119 | | - |
1120 | if (QApplicationPrivate::focus_widget) { evaluated: QApplicationPrivate::focus_widget yes Evaluation Count:3 | yes Evaluation Count:62 |
| 3-62 |
1121 | QFocusEvent in(QEvent::FocusIn, Qt::OtherFocusReason); executed (the execution status of this line is deduced): QFocusEvent in(QEvent::FocusIn, Qt::OtherFocusReason); | - |
1122 | QApplication::sendEvent(QApplicationPrivate::focus_widget->style(), &in); executed (the execution status of this line is deduced): QApplication::sendEvent(QApplicationPrivate::focus_widget->style(), &in); | - |
1123 | QApplicationPrivate::focus_widget->update(); executed (the execution status of this line is deduced): QApplicationPrivate::focus_widget->update(); | - |
1124 | } executed: } Execution Count:3 | 3 |
1125 | } executed: } Execution Count:65 | 65 |
1126 | | - |
1127 | /*! | - |
1128 | \overload | - |
1129 | | - |
1130 | Requests a QStyle object for \a style from the QStyleFactory. | - |
1131 | | - |
1132 | The string must be one of the QStyleFactory::keys(), typically one of | - |
1133 | "windows", "fusion", "windowsxp", or "macintosh". Style | - |
1134 | names are case insensitive. | - |
1135 | | - |
1136 | Returns 0 if an unknown \a style is passed, otherwise the QStyle object | - |
1137 | returned is set as the application's GUI style. | - |
1138 | | - |
1139 | \warning To ensure that the application's style is set correctly, it is | - |
1140 | best to call this function before the QApplication constructor, if | - |
1141 | possible. | - |
1142 | */ | - |
1143 | QStyle* QApplication::setStyle(const QString& style) | - |
1144 | { | - |
1145 | QStyle *s = QStyleFactory::create(style); executed (the execution status of this line is deduced): QStyle *s = QStyleFactory::create(style); | - |
1146 | if (!s) partially evaluated: !s no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1147 | return 0; never executed: return 0; | 0 |
1148 | | - |
1149 | setStyle(s); executed (the execution status of this line is deduced): setStyle(s); | - |
1150 | return s; executed: return s; Execution Count:1 | 1 |
1151 | } | - |
1152 | | - |
1153 | /*! | - |
1154 | Returns the color specification. | - |
1155 | | - |
1156 | \sa QApplication::setColorSpec() | - |
1157 | */ | - |
1158 | | - |
1159 | int QApplication::colorSpec() | - |
1160 | { | - |
1161 | return QApplicationPrivate::app_cspec; never executed: return QApplicationPrivate::app_cspec; | 0 |
1162 | } | - |
1163 | | - |
1164 | /*! | - |
1165 | Sets the color specification for the application to \a spec. | - |
1166 | | - |
1167 | The color specification controls how the application allocates colors when | - |
1168 | run on a display with a limited amount of colors, e.g. 8 bit / 256 color | - |
1169 | displays. | - |
1170 | | - |
1171 | The color specification must be set before you create the QApplication | - |
1172 | object. | - |
1173 | | - |
1174 | The options are: | - |
1175 | \list | - |
1176 | \li QApplication::NormalColor. This is the default color allocation | - |
1177 | strategy. Use this option if your application uses buttons, menus, | - |
1178 | texts and pixmaps with few colors. With this option, the | - |
1179 | application uses system global colors. This works fine for most | - |
1180 | applications under X11, but on the Windows platform, it may cause | - |
1181 | dithering of non-standard colors. | - |
1182 | \li QApplication::CustomColor. Use this option if your application | - |
1183 | needs a small number of custom colors. On X11, this option is the | - |
1184 | same as NormalColor. On Windows, Qt creates a Windows palette, and | - |
1185 | allocates colors to it on demand. | - |
1186 | \li QApplication::ManyColor. Use this option if your application is | - |
1187 | very color hungry, e.g., it requires thousands of colors. \br | - |
1188 | Under X11 the effect is: | - |
1189 | \list | - |
1190 | \li For 256-color displays which have at best a 256 color true | - |
1191 | color visual, the default visual is used, and colors are | - |
1192 | allocated from a color cube. The color cube is the 6x6x6 | - |
1193 | (216 color) "Web palette" (the red, green, and blue | - |
1194 | components always have one of the following values: 0x00, | - |
1195 | 0x33, 0x66, 0x99, 0xCC, or 0xFF), but the number of colors | - |
1196 | can be changed by the \e -ncols option. The user can force | - |
1197 | the application to use the true color visual with the | - |
1198 | \l{QApplication::QApplication()}{-visual} option. | - |
1199 | \li For 256-color displays which have a true color visual with | - |
1200 | more than 256 colors, use that visual. Silicon Graphics X | - |
1201 | servers this feature, for example. They provide an 8 bit | - |
1202 | visual by default but can deliver true color when asked. | - |
1203 | \endlist | - |
1204 | On Windows, Qt creates a Windows palette, and fills it with a color | - |
1205 | cube. | - |
1206 | \endlist | - |
1207 | | - |
1208 | Be aware that the CustomColor and ManyColor choices may lead to colormap | - |
1209 | flashing: The foreground application gets (most) of the available colors, | - |
1210 | while the background windows will look less attractive. | - |
1211 | | - |
1212 | Example: | - |
1213 | | - |
1214 | \snippet code/src_gui_kernel_qapplication.cpp 2 | - |
1215 | | - |
1216 | \sa colorSpec() | - |
1217 | */ | - |
1218 | | - |
1219 | void QApplication::setColorSpec(int spec) | - |
1220 | { | - |
1221 | if (qApp) never evaluated: (static_cast<QApplication *>(QCoreApplication::instance())) | 0 |
1222 | qWarning("QApplication::setColorSpec: This function must be " never executed: QMessageLogger("kernel/qapplication.cpp", 1222, __PRETTY_FUNCTION__).warning("QApplication::setColorSpec: This function must be " "called before the QApplication object is created"); | 0 |
1223 | "called before the QApplication object is created"); never executed: QMessageLogger("kernel/qapplication.cpp", 1222, __PRETTY_FUNCTION__).warning("QApplication::setColorSpec: This function must be " "called before the QApplication object is created"); | 0 |
1224 | QApplicationPrivate::app_cspec = spec; never executed (the execution status of this line is deduced): QApplicationPrivate::app_cspec = spec; | - |
1225 | } | 0 |
1226 | | - |
1227 | /*! | - |
1228 | \property QApplication::globalStrut | - |
1229 | \brief the minimum size that any GUI element that the user can interact | - |
1230 | with should have | - |
1231 | | - |
1232 | For example, no button should be resized to be smaller than the global | - |
1233 | strut size. The strut size should be considered when reimplementing GUI | - |
1234 | controls that may be used on touch-screens or similar I/O devices. | - |
1235 | | - |
1236 | Example: | - |
1237 | | - |
1238 | \snippet code/src_gui_kernel_qapplication.cpp 3 | - |
1239 | | - |
1240 | By default, this property contains a QSize object with zero width and height. | - |
1241 | */ | - |
1242 | QSize QApplication::globalStrut() | - |
1243 | { | - |
1244 | return QApplicationPrivate::app_strut; executed: return QApplicationPrivate::app_strut; Execution Count:241925 | 241925 |
1245 | } | - |
1246 | | - |
1247 | void QApplication::setGlobalStrut(const QSize& strut) | - |
1248 | { | - |
1249 | QApplicationPrivate::app_strut = strut; never executed (the execution status of this line is deduced): QApplicationPrivate::app_strut = strut; | - |
1250 | } | 0 |
1251 | | - |
1252 | | - |
1253 | /*! | - |
1254 | \fn QPalette QApplication::palette(const QWidget* widget) | - |
1255 | \overload | - |
1256 | | - |
1257 | If a \a widget is passed, the default palette for the widget's class is | - |
1258 | returned. This may or may not be the application palette. In most cases | - |
1259 | there is no special palette for certain types of widgets, but one notable | - |
1260 | exception is the popup menu under Windows, if the user has defined a | - |
1261 | special background color for menus in the display settings. | - |
1262 | | - |
1263 | \sa setPalette(), QWidget::palette() | - |
1264 | */ | - |
1265 | QPalette QApplication::palette(const QWidget* w) | - |
1266 | { | - |
1267 | PaletteHash *hash = app_palettes(); executed (the execution status of this line is deduced): PaletteHash *hash = app_palettes(); | - |
1268 | if (w && hash && hash->size()) { partially evaluated: w yes Evaluation Count:85005 | no Evaluation Count:0 |
partially evaluated: hash yes Evaluation Count:85005 | no Evaluation Count:0 |
evaluated: hash->size() yes Evaluation Count:846 | yes Evaluation Count:84159 |
| 0-85005 |
1269 | QHash<QByteArray, QPalette>::ConstIterator it = hash->constFind(w->metaObject()->className()); executed (the execution status of this line is deduced): QHash<QByteArray, QPalette>::ConstIterator it = hash->constFind(w->metaObject()->className()); | - |
1270 | if (it != hash->constEnd()) evaluated: it != hash->constEnd() yes Evaluation Count:6 | yes Evaluation Count:840 |
| 6-840 |
1271 | return *it; executed: return *it; Execution Count:6 | 6 |
1272 | for (it = hash->constBegin(); it != hash->constEnd(); ++it) { evaluated: it != hash->constEnd() yes Evaluation Count:840 | yes Evaluation Count:840 |
| 840 |
1273 | if (w->inherits(it.key())) partially evaluated: w->inherits(it.key()) no Evaluation Count:0 | yes Evaluation Count:840 |
| 0-840 |
1274 | return it.value(); never executed: return it.value(); | 0 |
1275 | } executed: } Execution Count:840 | 840 |
1276 | } executed: } Execution Count:840 | 840 |
1277 | return palette(); executed: return palette(); Execution Count:84999 | 84999 |
1278 | } | - |
1279 | | - |
1280 | /*! | - |
1281 | \overload | - |
1282 | | - |
1283 | Returns the palette for widgets of the given \a className. | - |
1284 | | - |
1285 | \sa setPalette(), QWidget::palette() | - |
1286 | */ | - |
1287 | QPalette QApplication::palette(const char *className) | - |
1288 | { | - |
1289 | if (!QApplicationPrivate::app_pal) partially evaluated: !QApplicationPrivate::app_pal no Evaluation Count:0 | yes Evaluation Count:291 |
| 0-291 |
1290 | palette(); never executed: palette(); | 0 |
1291 | PaletteHash *hash = app_palettes(); executed (the execution status of this line is deduced): PaletteHash *hash = app_palettes(); | - |
1292 | if (className && hash && hash->size()) { partially evaluated: className yes Evaluation Count:291 | no Evaluation Count:0 |
partially evaluated: hash yes Evaluation Count:291 | no Evaluation Count:0 |
partially evaluated: hash->size() no Evaluation Count:0 | yes Evaluation Count:291 |
| 0-291 |
1293 | QHash<QByteArray, QPalette>::ConstIterator it = hash->constFind(className); never executed (the execution status of this line is deduced): QHash<QByteArray, QPalette>::ConstIterator it = hash->constFind(className); | - |
1294 | if (it != hash->constEnd()) never evaluated: it != hash->constEnd() | 0 |
1295 | return *it; never executed: return *it; | 0 |
1296 | } | 0 |
1297 | return *QApplicationPrivate::app_pal; executed: return *QApplicationPrivate::app_pal; Execution Count:291 | 291 |
1298 | } | - |
1299 | | - |
1300 | void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash) | - |
1301 | { | - |
1302 | QPalette pal = palette; executed (the execution status of this line is deduced): QPalette pal = palette; | - |
1303 | | - |
1304 | if (QApplicationPrivate::app_style) partially evaluated: QApplicationPrivate::app_style yes Evaluation Count:284 | no Evaluation Count:0 |
| 0-284 |
1305 | QApplicationPrivate::app_style->polish(pal); // NB: non-const reference executed: QApplicationPrivate::app_style->polish(pal); Execution Count:284 | 284 |
1306 | | - |
1307 | bool all = false; executed (the execution status of this line is deduced): bool all = false; | - |
1308 | PaletteHash *hash = app_palettes(); executed (the execution status of this line is deduced): PaletteHash *hash = app_palettes(); | - |
1309 | if (!className) { evaluated: !className yes Evaluation Count:282 | yes Evaluation Count:2 |
| 2-282 |
1310 | if (QApplicationPrivate::app_pal && pal.isCopyOf(*QApplicationPrivate::app_pal)) evaluated: QApplicationPrivate::app_pal yes Evaluation Count:67 | yes Evaluation Count:215 |
evaluated: pal.isCopyOf(*QApplicationPrivate::app_pal) yes Evaluation Count:65 | yes Evaluation Count:2 |
| 2-215 |
1311 | return; executed: return; Execution Count:65 | 65 |
1312 | if (!QApplicationPrivate::app_pal) evaluated: !QApplicationPrivate::app_pal yes Evaluation Count:215 | yes Evaluation Count:2 |
| 2-215 |
1313 | QApplicationPrivate::app_pal = new QPalette(pal); executed: QApplicationPrivate::app_pal = new QPalette(pal); Execution Count:215 | 215 |
1314 | else | - |
1315 | *QApplicationPrivate::app_pal = pal; executed: *QApplicationPrivate::app_pal = pal; Execution Count:2 | 2 |
1316 | if (hash && hash->size()) { partially evaluated: hash yes Evaluation Count:217 | no Evaluation Count:0 |
evaluated: hash->size() yes Evaluation Count:1 | yes Evaluation Count:216 |
| 0-217 |
1317 | all = true; executed (the execution status of this line is deduced): all = true; | - |
1318 | if (clearWidgetPaletteHash) partially evaluated: clearWidgetPaletteHash yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1319 | hash->clear(); executed: hash->clear(); Execution Count:1 | 1 |
1320 | } executed: } Execution Count:1 | 1 |
1321 | } else if (hash) { executed: } Execution Count:217 partially evaluated: hash yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-217 |
1322 | hash->insert(className, pal); executed (the execution status of this line is deduced): hash->insert(className, pal); | - |
1323 | } executed: } Execution Count:2 | 2 |
1324 | | - |
1325 | if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { evaluated: QApplicationPrivate::is_app_running yes Evaluation Count:218 | yes Evaluation Count:1 |
partially evaluated: !QApplicationPrivate::is_app_closing yes Evaluation Count:218 | no Evaluation Count:0 |
| 0-218 |
1326 | // Send ApplicationPaletteChange to qApp itself, and to the widgets. | - |
1327 | QEvent e(QEvent::ApplicationPaletteChange); executed (the execution status of this line is deduced): QEvent e(QEvent::ApplicationPaletteChange); | - |
1328 | QApplication::sendEvent(QApplication::instance(), &e); executed (the execution status of this line is deduced): QApplication::sendEvent(QApplication::instance(), &e); | - |
1329 | | - |
1330 | QWidgetList wids = QApplication::allWidgets(); executed (the execution status of this line is deduced): QWidgetList wids = QApplication::allWidgets(); | - |
1331 | for (QWidgetList::ConstIterator it = wids.constBegin(); it != wids.constEnd(); ++it) { evaluated: it != wids.constEnd() yes Evaluation Count:71 | yes Evaluation Count:218 |
| 71-218 |
1332 | register QWidget *w = *it; executed (the execution status of this line is deduced): register QWidget *w = *it; | - |
1333 | if (all || (!className && w->isWindow()) || w->inherits(className)) // matching class evaluated: all yes Evaluation Count:27 | yes Evaluation Count:44 |
evaluated: !className yes Evaluation Count:28 | yes Evaluation Count:16 |
evaluated: w->isWindow() yes Evaluation Count:5 | yes Evaluation Count:23 |
evaluated: w->inherits(className) yes Evaluation Count:1 | yes Evaluation Count:38 |
| 1-44 |
1334 | QApplication::sendEvent(w, &e); executed: QApplication::sendEvent(w, &e); Execution Count:33 | 33 |
1335 | } executed: } Execution Count:71 | 71 |
1336 | | - |
1337 | // Send to all scenes as well. | - |
1338 | #ifndef QT_NO_GRAPHICSVIEW | - |
1339 | QList<QGraphicsScene *> &scenes = qApp->d_func()->scene_list; executed (the execution status of this line is deduced): QList<QGraphicsScene *> &scenes = (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->scene_list; | - |
1340 | for (QList<QGraphicsScene *>::ConstIterator it = scenes.constBegin(); executed (the execution status of this line is deduced): for (QList<QGraphicsScene *>::ConstIterator it = scenes.constBegin(); | - |
1341 | it != scenes.constEnd(); ++it) { partially evaluated: it != scenes.constEnd() no Evaluation Count:0 | yes Evaluation Count:218 |
| 0-218 |
1342 | QApplication::sendEvent(*it, &e); never executed (the execution status of this line is deduced): QApplication::sendEvent(*it, &e); | - |
1343 | } | 0 |
1344 | #endif //QT_NO_GRAPHICSVIEW | - |
1345 | } executed: } Execution Count:218 | 218 |
1346 | if (!className && (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))) { evaluated: !className yes Evaluation Count:217 | yes Evaluation Count:2 |
partially evaluated: !QApplicationPrivate::sys_pal no Evaluation Count:0 | yes Evaluation Count:217 |
evaluated: !palette.isCopyOf(*QApplicationPrivate::sys_pal) yes Evaluation Count:1 | yes Evaluation Count:216 |
| 0-217 |
1347 | if (!QApplicationPrivate::set_pal) partially evaluated: !QApplicationPrivate::set_pal yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1348 | QApplicationPrivate::set_pal = new QPalette(palette); executed: QApplicationPrivate::set_pal = new QPalette(palette); Execution Count:1 | 1 |
1349 | else | - |
1350 | *QApplicationPrivate::set_pal = palette; never executed: *QApplicationPrivate::set_pal = palette; | 0 |
1351 | } | - |
1352 | } executed: } Execution Count:219 | 219 |
1353 | | - |
1354 | /*! | - |
1355 | Changes the default application palette to \a palette. | - |
1356 | | - |
1357 | If \a className is passed, the change applies only to widgets that inherit | - |
1358 | \a className (as reported by QObject::inherits()). If \a className is left | - |
1359 | 0, the change affects all widgets, thus overriding any previously set class | - |
1360 | specific palettes. | - |
1361 | | - |
1362 | The palette may be changed according to the current GUI style in | - |
1363 | QStyle::polish(). | - |
1364 | | - |
1365 | \warning Do not use this function in conjunction with \l{Qt Style Sheets}. | - |
1366 | When using style sheets, the palette of a widget can be customized using | - |
1367 | the "color", "background-color", "selection-color", | - |
1368 | "selection-background-color" and "alternate-background-color". | - |
1369 | | - |
1370 | \note Some styles do not use the palette for all drawing, for instance, if | - |
1371 | they make use of native theme engines. This is the case for the Windows XP, | - |
1372 | Windows Vista, and Mac OS X styles. | - |
1373 | | - |
1374 | \sa QWidget::setPalette(), palette(), QStyle::polish() | - |
1375 | */ | - |
1376 | | - |
1377 | void QApplication::setPalette(const QPalette &palette, const char* className) | - |
1378 | { | - |
1379 | QApplicationPrivate::setPalette_helper(palette, className, /*clearWidgetPaletteHash=*/ true); executed (the execution status of this line is deduced): QApplicationPrivate::setPalette_helper(palette, className, true); | - |
1380 | } executed: } Execution Count:220 | 220 |
1381 | | - |
1382 | | - |
1383 | | - |
1384 | void QApplicationPrivate::setSystemPalette(const QPalette &pal) | - |
1385 | { | - |
1386 | QPalette adjusted; executed (the execution status of this line is deduced): QPalette adjusted; | - |
1387 | | - |
1388 | #if 0 | - |
1389 | // adjust the system palette to avoid dithering | - |
1390 | QColormap cmap = QColormap::instance(); | - |
1391 | if (cmap.depths() > 4 && cmap.depths() < 24) { | - |
1392 | for (int g = 0; g < QPalette::NColorGroups; g++) | - |
1393 | for (int i = 0; i < QPalette::NColorRoles; i++) { | - |
1394 | QColor color = pal.color((QPalette::ColorGroup)g, (QPalette::ColorRole)i); | - |
1395 | color = cmap.colorAt(cmap.pixel(color)); | - |
1396 | adjusted.setColor((QPalette::ColorGroup)g, (QPalette::ColorRole) i, color); | - |
1397 | } | - |
1398 | } | - |
1399 | #else | - |
1400 | adjusted = pal; executed (the execution status of this line is deduced): adjusted = pal; | - |
1401 | #endif | - |
1402 | | - |
1403 | if (!sys_pal) partially evaluated: !sys_pal yes Evaluation Count:215 | no Evaluation Count:0 |
| 0-215 |
1404 | sys_pal = new QPalette(adjusted); executed: sys_pal = new QPalette(adjusted); Execution Count:215 | 215 |
1405 | else | - |
1406 | *sys_pal = adjusted; never executed: *sys_pal = adjusted; | 0 |
1407 | | - |
1408 | | - |
1409 | if (!QApplicationPrivate::set_pal) partially evaluated: !QApplicationPrivate::set_pal yes Evaluation Count:215 | no Evaluation Count:0 |
| 0-215 |
1410 | QApplication::setPalette(*sys_pal); executed: QApplication::setPalette(*sys_pal); Execution Count:215 | 215 |
1411 | } executed: } Execution Count:215 | 215 |
1412 | | - |
1413 | /*! | - |
1414 | Returns the default application font. | - |
1415 | | - |
1416 | \sa fontMetrics(), QWidget::font() | - |
1417 | */ | - |
1418 | QFont QApplication::font() | - |
1419 | { | - |
1420 | return QGuiApplication::font(); executed: return QGuiApplication::font(); Execution Count:159229 | 159229 |
1421 | } | - |
1422 | | - |
1423 | /*! | - |
1424 | \overload | - |
1425 | | - |
1426 | Returns the default font for the \a widget. | - |
1427 | | - |
1428 | \sa fontMetrics(), QWidget::setFont() | - |
1429 | */ | - |
1430 | | - |
1431 | QFont QApplication::font(const QWidget *widget) | - |
1432 | { | - |
1433 | FontHash *hash = app_fonts(); executed (the execution status of this line is deduced): FontHash *hash = app_fonts(); | - |
1434 | | - |
1435 | if (widget && hash && hash->size()) { partially evaluated: widget yes Evaluation Count:79780 | no Evaluation Count:0 |
partially evaluated: hash yes Evaluation Count:79780 | no Evaluation Count:0 |
evaluated: hash->size() yes Evaluation Count:1565 | yes Evaluation Count:78215 |
| 0-79780 |
1436 | #ifdef Q_OS_MAC | - |
1437 | // short circuit for small and mini controls | - |
1438 | if (widget->testAttribute(Qt::WA_MacSmallSize)) { | - |
1439 | return hash->value(QByteArrayLiteral("QSmallFont")); | - |
1440 | } else if (widget->testAttribute(Qt::WA_MacMiniSize)) { | - |
1441 | return hash->value(QByteArrayLiteral("QMiniFont")); | - |
1442 | } | - |
1443 | #endif | - |
1444 | QHash<QByteArray, QFont>::ConstIterator it = executed (the execution status of this line is deduced): QHash<QByteArray, QFont>::ConstIterator it = | - |
1445 | hash->constFind(widget->metaObject()->className()); executed (the execution status of this line is deduced): hash->constFind(widget->metaObject()->className()); | - |
1446 | if (it != hash->constEnd()) evaluated: it != hash->constEnd() yes Evaluation Count:6 | yes Evaluation Count:1559 |
| 6-1559 |
1447 | return it.value(); executed: return it.value(); Execution Count:6 | 6 |
1448 | for (it = hash->constBegin(); it != hash->constEnd(); ++it) { evaluated: it != hash->constEnd() yes Evaluation Count:1559 | yes Evaluation Count:1559 |
| 1559 |
1449 | if (widget->inherits(it.key())) partially evaluated: widget->inherits(it.key()) no Evaluation Count:0 | yes Evaluation Count:1559 |
| 0-1559 |
1450 | return it.value(); never executed: return it.value(); | 0 |
1451 | } executed: } Execution Count:1559 | 1559 |
1452 | } executed: } Execution Count:1559 | 1559 |
1453 | return font(); executed: return font(); Execution Count:79774 | 79774 |
1454 | } | - |
1455 | | - |
1456 | /*! | - |
1457 | \overload | - |
1458 | | - |
1459 | Returns the font for widgets of the given \a className. | - |
1460 | | - |
1461 | \sa setFont(), QWidget::font() | - |
1462 | */ | - |
1463 | QFont QApplication::font(const char *className) | - |
1464 | { | - |
1465 | FontHash *hash = app_fonts(); executed (the execution status of this line is deduced): FontHash *hash = app_fonts(); | - |
1466 | if (className && hash && hash->size()) { partially evaluated: className yes Evaluation Count:434 | no Evaluation Count:0 |
partially evaluated: hash yes Evaluation Count:434 | no Evaluation Count:0 |
evaluated: hash->size() yes Evaluation Count:2 | yes Evaluation Count:432 |
| 0-434 |
1467 | QHash<QByteArray, QFont>::ConstIterator it = hash->constFind(className); executed (the execution status of this line is deduced): QHash<QByteArray, QFont>::ConstIterator it = hash->constFind(className); | - |
1468 | if (it != hash->constEnd()) partially evaluated: it != hash->constEnd() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1469 | return *it; never executed: return *it; | 0 |
1470 | } executed: } Execution Count:2 | 2 |
1471 | return font(); executed: return font(); Execution Count:434 | 434 |
1472 | } | - |
1473 | | - |
1474 | | - |
1475 | /*! | - |
1476 | Changes the default application font to \a font. If \a className is passed, | - |
1477 | the change applies only to classes that inherit \a className (as reported | - |
1478 | by QObject::inherits()). | - |
1479 | | - |
1480 | On application start-up, the default font depends on the window system. It | - |
1481 | can vary depending on both the window system version and the locale. This | - |
1482 | function lets you override the default font; but overriding may be a bad | - |
1483 | idea because, for example, some locales need extra large fonts to support | - |
1484 | their special characters. | - |
1485 | | - |
1486 | \warning Do not use this function in conjunction with \l{Qt Style Sheets}. | - |
1487 | The font of an application can be customized using the "font" style sheet | - |
1488 | property. To set a bold font for all QPushButtons, set the application | - |
1489 | styleSheet() as "QPushButton { font: bold }" | - |
1490 | | - |
1491 | \sa font(), fontMetrics(), QWidget::setFont() | - |
1492 | */ | - |
1493 | | - |
1494 | void QApplication::setFont(const QFont &font, const char *className) | - |
1495 | { | - |
1496 | bool all = false; executed (the execution status of this line is deduced): bool all = false; | - |
1497 | FontHash *hash = app_fonts(); executed (the execution status of this line is deduced): FontHash *hash = app_fonts(); | - |
1498 | if (!className) { evaluated: !className yes Evaluation Count:15 | yes Evaluation Count:2 |
| 2-15 |
1499 | QGuiApplication::setFont(font); executed (the execution status of this line is deduced): QGuiApplication::setFont(font); | - |
1500 | if (hash && hash->size()) { partially evaluated: hash yes Evaluation Count:15 | no Evaluation Count:0 |
partially evaluated: hash->size() no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
1501 | all = true; never executed (the execution status of this line is deduced): all = true; | - |
1502 | hash->clear(); never executed (the execution status of this line is deduced): hash->clear(); | - |
1503 | } | 0 |
1504 | } else if (hash) { executed: } Execution Count:15 partially evaluated: hash yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-15 |
1505 | hash->insert(className, font); executed (the execution status of this line is deduced): hash->insert(className, font); | - |
1506 | } executed: } Execution Count:2 | 2 |
1507 | if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { evaluated: QApplicationPrivate::is_app_running yes Evaluation Count:11 | yes Evaluation Count:6 |
partially evaluated: !QApplicationPrivate::is_app_closing yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
1508 | // Send ApplicationFontChange to qApp itself, and to the widgets. | - |
1509 | QEvent e(QEvent::ApplicationFontChange); executed (the execution status of this line is deduced): QEvent e(QEvent::ApplicationFontChange); | - |
1510 | QApplication::sendEvent(QApplication::instance(), &e); executed (the execution status of this line is deduced): QApplication::sendEvent(QApplication::instance(), &e); | - |
1511 | | - |
1512 | QWidgetList wids = QApplication::allWidgets(); executed (the execution status of this line is deduced): QWidgetList wids = QApplication::allWidgets(); | - |
1513 | for (QWidgetList::ConstIterator it = wids.constBegin(); it != wids.constEnd(); ++it) { evaluated: it != wids.constEnd() yes Evaluation Count:21 | yes Evaluation Count:11 |
| 11-21 |
1514 | register QWidget *w = *it; executed (the execution status of this line is deduced): register QWidget *w = *it; | - |
1515 | if (all || (!className && w->isWindow()) || w->inherits(className)) // matching class partially evaluated: all no Evaluation Count:0 | yes Evaluation Count:21 |
evaluated: !className yes Evaluation Count:7 | yes Evaluation Count:14 |
partially evaluated: w->isWindow() yes Evaluation Count:7 | no Evaluation Count:0 |
evaluated: w->inherits(className) yes Evaluation Count:1 | yes Evaluation Count:13 |
| 0-21 |
1516 | sendEvent(w, &e); executed: sendEvent(w, &e); Execution Count:8 | 8 |
1517 | } executed: } Execution Count:21 | 21 |
1518 | | - |
1519 | #ifndef QT_NO_GRAPHICSVIEW | - |
1520 | // Send to all scenes as well. | - |
1521 | QList<QGraphicsScene *> &scenes = qApp->d_func()->scene_list; executed (the execution status of this line is deduced): QList<QGraphicsScene *> &scenes = (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->scene_list; | - |
1522 | for (QList<QGraphicsScene *>::ConstIterator it = scenes.constBegin(); executed (the execution status of this line is deduced): for (QList<QGraphicsScene *>::ConstIterator it = scenes.constBegin(); | - |
1523 | it != scenes.constEnd(); ++it) { partially evaluated: it != scenes.constEnd() no Evaluation Count:0 | yes Evaluation Count:11 |
| 0-11 |
1524 | QApplication::sendEvent(*it, &e); never executed (the execution status of this line is deduced): QApplication::sendEvent(*it, &e); | - |
1525 | } | 0 |
1526 | #endif //QT_NO_GRAPHICSVIEW | - |
1527 | } executed: } Execution Count:11 | 11 |
1528 | if (!className && (!QApplicationPrivate::sys_font || !font.isCopyOf(*QApplicationPrivate::sys_font))) { evaluated: !className yes Evaluation Count:15 | yes Evaluation Count:2 |
partially evaluated: !QApplicationPrivate::sys_font yes Evaluation Count:15 | no Evaluation Count:0 |
never evaluated: !font.isCopyOf(*QApplicationPrivate::sys_font) | 0-15 |
1529 | if (!QApplicationPrivate::set_font) evaluated: !QApplicationPrivate::set_font yes Evaluation Count:14 | yes Evaluation Count:1 |
| 1-14 |
1530 | QApplicationPrivate::set_font = new QFont(font); executed: QApplicationPrivate::set_font = new QFont(font); Execution Count:14 | 14 |
1531 | else | - |
1532 | *QApplicationPrivate::set_font = font; executed: *QApplicationPrivate::set_font = font; Execution Count:1 | 1 |
1533 | } | - |
1534 | } executed: } Execution Count:17 | 17 |
1535 | | - |
1536 | /*! \internal | - |
1537 | */ | - |
1538 | void QApplicationPrivate::setSystemFont(const QFont &font) | - |
1539 | { | - |
1540 | if (!sys_font) never evaluated: !sys_font | 0 |
1541 | sys_font = new QFont(font); never executed: sys_font = new QFont(font); | 0 |
1542 | else | - |
1543 | *sys_font = font; never executed: *sys_font = font; | 0 |
1544 | | - |
1545 | if (!QApplicationPrivate::set_font) never evaluated: !QApplicationPrivate::set_font | 0 |
1546 | QApplication::setFont(*sys_font); never executed: QApplication::setFont(*sys_font); | 0 |
1547 | } | 0 |
1548 | | - |
1549 | /*! \internal | - |
1550 | */ | - |
1551 | QString QApplicationPrivate::desktopStyleKey() | - |
1552 | { | - |
1553 | // The platform theme might return a style that is not available, find | - |
1554 | // first valid one. | - |
1555 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { partially evaluated: const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme() yes Evaluation Count:217 | no Evaluation Count:0 |
| 0-217 |
1556 | const QStringList availableKeys = QStyleFactory::keys(); executed (the execution status of this line is deduced): const QStringList availableKeys = QStyleFactory::keys(); | - |
1557 | foreach (const QString &style, theme->themeHint(QPlatformTheme::StyleNames).toStringList()) executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(theme->themeHint(QPlatformTheme::StyleNames).toStringList())> _container_(theme->themeHint(QPlatformTheme::StyleNames).toStringList()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QString &style = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
1558 | if (availableKeys.contains(style, Qt::CaseInsensitive)) evaluated: availableKeys.contains(style, Qt::CaseInsensitive) yes Evaluation Count:217 | yes Evaluation Count:434 |
| 217-434 |
1559 | return style; executed: return style; Execution Count:217 | 217 |
1560 | } | 0 |
1561 | return QString(); never executed: return QString(); | 0 |
1562 | } | - |
1563 | | - |
1564 | /*! | - |
1565 | \property QApplication::windowIcon | - |
1566 | \brief the default window icon | - |
1567 | | - |
1568 | \sa QWidget::setWindowIcon(), {Setting the Application Icon} | - |
1569 | */ | - |
1570 | QIcon QApplication::windowIcon() | - |
1571 | { | - |
1572 | return QApplicationPrivate::app_icon ? *QApplicationPrivate::app_icon : QIcon(); executed: return QApplicationPrivate::app_icon ? *QApplicationPrivate::app_icon : QIcon(); Execution Count:3019 | 3019 |
1573 | } | - |
1574 | | - |
1575 | void QApplication::setWindowIcon(const QIcon &icon) | - |
1576 | { | - |
1577 | if (!QApplicationPrivate::app_icon) evaluated: !QApplicationPrivate::app_icon yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
1578 | QApplicationPrivate::app_icon = new QIcon(); executed: QApplicationPrivate::app_icon = new QIcon(); Execution Count:1 | 1 |
1579 | *QApplicationPrivate::app_icon = icon; executed (the execution status of this line is deduced): *QApplicationPrivate::app_icon = icon; | - |
1580 | if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { partially evaluated: QApplicationPrivate::is_app_running yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: !QApplicationPrivate::is_app_closing yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1581 | QEvent e(QEvent::ApplicationWindowIconChange); executed (the execution status of this line is deduced): QEvent e(QEvent::ApplicationWindowIconChange); | - |
1582 | QWidgetList all = QApplication::allWidgets(); executed (the execution status of this line is deduced): QWidgetList all = QApplication::allWidgets(); | - |
1583 | for (QWidgetList::ConstIterator it = all.constBegin(); it != all.constEnd(); ++it) { evaluated: it != all.constEnd() yes Evaluation Count:58 | yes Evaluation Count:2 |
| 2-58 |
1584 | register QWidget *w = *it; executed (the execution status of this line is deduced): register QWidget *w = *it; | - |
1585 | if (w->isWindow()) evaluated: w->isWindow() yes Evaluation Count:10 | yes Evaluation Count:48 |
| 10-48 |
1586 | sendEvent(w, &e); executed: sendEvent(w, &e); Execution Count:10 | 10 |
1587 | } executed: } Execution Count:58 | 58 |
1588 | } executed: } Execution Count:2 | 2 |
1589 | } executed: } Execution Count:2 | 2 |
1590 | | - |
1591 | /*! | - |
1592 | Returns a list of the top-level widgets (windows) in the application. | - |
1593 | | - |
1594 | \note Some of the top-level widgets may be hidden, for example a tooltip if | - |
1595 | no tooltip is currently shown. | - |
1596 | | - |
1597 | Example: | - |
1598 | | - |
1599 | \snippet code/src_gui_kernel_qapplication.cpp 4 | - |
1600 | | - |
1601 | \sa allWidgets(), QWidget::isWindow(), QWidget::isHidden() | - |
1602 | */ | - |
1603 | QWidgetList QApplication::topLevelWidgets() | - |
1604 | { | - |
1605 | QWidgetList list; executed (the execution status of this line is deduced): QWidgetList list; | - |
1606 | QWidgetList all = allWidgets(); executed (the execution status of this line is deduced): QWidgetList all = allWidgets(); | - |
1607 | | - |
1608 | for (QWidgetList::ConstIterator it = all.constBegin(); it != all.constEnd(); ++it) { evaluated: it != all.constEnd() yes Evaluation Count:72686 | yes Evaluation Count:4379 |
| 4379-72686 |
1609 | QWidget *w = *it; executed (the execution status of this line is deduced): QWidget *w = *it; | - |
1610 | if (w->isWindow() && w->windowType() != Qt::Desktop) evaluated: w->isWindow() yes Evaluation Count:18796 | yes Evaluation Count:53890 |
evaluated: w->windowType() != Qt::Desktop yes Evaluation Count:10079 | yes Evaluation Count:8717 |
| 8717-53890 |
1611 | list.append(w); executed: list.append(w); Execution Count:10079 | 10079 |
1612 | } executed: } Execution Count:72686 | 72686 |
1613 | return list; executed: return list; Execution Count:4379 | 4379 |
1614 | } | - |
1615 | | - |
1616 | /*! | - |
1617 | Returns a list of all the widgets in the application. | - |
1618 | | - |
1619 | The list is empty (QList::isEmpty()) if there are no widgets. | - |
1620 | | - |
1621 | \note Some of the widgets may be hidden. | - |
1622 | | - |
1623 | Example: | - |
1624 | \snippet code/src_gui_kernel_qapplication.cpp 5 | - |
1625 | | - |
1626 | \sa topLevelWidgets(), QWidget::isVisible() | - |
1627 | */ | - |
1628 | | - |
1629 | QWidgetList QApplication::allWidgets() | - |
1630 | { | - |
1631 | if (QWidgetPrivate::allWidgets) evaluated: QWidgetPrivate::allWidgets yes Evaluation Count:4677 | yes Evaluation Count:2 |
| 2-4677 |
1632 | return QWidgetPrivate::allWidgets->toList(); executed: return QWidgetPrivate::allWidgets->toList(); Execution Count:4677 | 4677 |
1633 | return QWidgetList(); executed: return QWidgetList(); Execution Count:2 | 2 |
1634 | } | - |
1635 | | - |
1636 | /*! | - |
1637 | Returns the application widget that has the keyboard input focus, or 0 if | - |
1638 | no widget in this application has the focus. | - |
1639 | | - |
1640 | \sa QWidget::setFocus(), QWidget::hasFocus(), activeWindow(), focusChanged() | - |
1641 | */ | - |
1642 | | - |
1643 | QWidget *QApplication::focusWidget() | - |
1644 | { | - |
1645 | return QApplicationPrivate::focus_widget; executed: return QApplicationPrivate::focus_widget; Execution Count:476713 | 476713 |
1646 | } | - |
1647 | | - |
1648 | void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) | - |
1649 | { | - |
1650 | #ifndef QT_NO_GRAPHICSVIEW | - |
1651 | if (focus && focus->window()->graphicsProxyWidget()) evaluated: focus yes Evaluation Count:1672 | yes Evaluation Count:1635 |
partially evaluated: focus->window()->graphicsProxyWidget() no Evaluation Count:0 | yes Evaluation Count:1672 |
| 0-1672 |
1652 | return; | 0 |
1653 | #endif | - |
1654 | | - |
1655 | hidden_focus_widget = 0; executed (the execution status of this line is deduced): hidden_focus_widget = 0; | - |
1656 | | - |
1657 | if (focus != focus_widget) { evaluated: focus != focus_widget yes Evaluation Count:3020 | yes Evaluation Count:287 |
| 287-3020 |
1658 | if (focus && focus->isHidden()) { evaluated: focus yes Evaluation Count:1672 | yes Evaluation Count:1348 |
evaluated: focus->isHidden() yes Evaluation Count:9 | yes Evaluation Count:1663 |
| 9-1672 |
1659 | hidden_focus_widget = focus; executed (the execution status of this line is deduced): hidden_focus_widget = focus; | - |
1660 | return; executed: return; Execution Count:9 | 9 |
1661 | } | - |
1662 | | - |
1663 | if (focus && (reason == Qt::BacktabFocusReason || reason == Qt::TabFocusReason) evaluated: focus yes Evaluation Count:1663 | yes Evaluation Count:1348 |
evaluated: reason == Qt::BacktabFocusReason yes Evaluation Count:15 | yes Evaluation Count:1648 |
evaluated: reason == Qt::TabFocusReason yes Evaluation Count:48 | yes Evaluation Count:1600 |
| 15-1663 |
1664 | && qt_in_tab_key_event) evaluated: qt_in_tab_key_event yes Evaluation Count:47 | yes Evaluation Count:16 |
| 16-47 |
1665 | focus->window()->setAttribute(Qt::WA_KeyboardFocusChange); executed: focus->window()->setAttribute(Qt::WA_KeyboardFocusChange); Execution Count:47 | 47 |
1666 | else if (focus && reason == Qt::ShortcutFocusReason) { evaluated: focus yes Evaluation Count:1616 | yes Evaluation Count:1348 |
evaluated: reason == Qt::ShortcutFocusReason yes Evaluation Count:2 | yes Evaluation Count:1614 |
| 2-1616 |
1667 | focus->window()->setAttribute(Qt::WA_KeyboardFocusChange); executed (the execution status of this line is deduced): focus->window()->setAttribute(Qt::WA_KeyboardFocusChange); | - |
1668 | } executed: } Execution Count:2 | 2 |
1669 | QWidget *prev = focus_widget; executed (the execution status of this line is deduced): QWidget *prev = focus_widget; | - |
1670 | focus_widget = focus; executed (the execution status of this line is deduced): focus_widget = focus; | - |
1671 | | - |
1672 | if(focus_widget) evaluated: focus_widget yes Evaluation Count:1663 | yes Evaluation Count:1348 |
| 1348-1663 |
1673 | focus_widget->d_func()->setFocus_sys(); executed: focus_widget->d_func()->setFocus_sys(); Execution Count:1663 | 1663 |
1674 | | - |
1675 | if (reason != Qt::NoFocusReason) { evaluated: reason != Qt::NoFocusReason yes Evaluation Count:3008 | yes Evaluation Count:3 |
| 3-3008 |
1676 | | - |
1677 | //send events | - |
1678 | if (prev) { evaluated: prev yes Evaluation Count:1662 | yes Evaluation Count:1346 |
| 1346-1662 |
1679 | #ifdef QT_KEYPAD_NAVIGATION | - |
1680 | if (QApplication::keypadNavigationEnabled()) { | - |
1681 | if (prev->hasEditFocus() && reason != Qt::PopupFocusReason) | - |
1682 | prev->setEditFocus(false); | - |
1683 | } | - |
1684 | #endif | - |
1685 | QFocusEvent out(QEvent::FocusOut, reason); executed (the execution status of this line is deduced): QFocusEvent out(QEvent::FocusOut, reason); | - |
1686 | QPointer<QWidget> that = prev; executed (the execution status of this line is deduced): QPointer<QWidget> that = prev; | - |
1687 | QApplication::sendEvent(prev, &out); executed (the execution status of this line is deduced): QApplication::sendEvent(prev, &out); | - |
1688 | if (that) partially evaluated: that yes Evaluation Count:1662 | no Evaluation Count:0 |
| 0-1662 |
1689 | QApplication::sendEvent(that->style(), &out); executed: QApplication::sendEvent(that->style(), &out); Execution Count:1662 | 1662 |
1690 | } executed: } Execution Count:1662 | 1662 |
1691 | if(focus && QApplicationPrivate::focus_widget == focus) { evaluated: focus yes Evaluation Count:1660 | yes Evaluation Count:1348 |
partially evaluated: QApplicationPrivate::focus_widget == focus yes Evaluation Count:1660 | no Evaluation Count:0 |
| 0-1660 |
1692 | QFocusEvent in(QEvent::FocusIn, reason); executed (the execution status of this line is deduced): QFocusEvent in(QEvent::FocusIn, reason); | - |
1693 | QPointer<QWidget> that = focus; executed (the execution status of this line is deduced): QPointer<QWidget> that = focus; | - |
1694 | QApplication::sendEvent(focus, &in); executed (the execution status of this line is deduced): QApplication::sendEvent(focus, &in); | - |
1695 | if (that) partially evaluated: that yes Evaluation Count:1660 | no Evaluation Count:0 |
| 0-1660 |
1696 | QApplication::sendEvent(that->style(), &in); executed: QApplication::sendEvent(that->style(), &in); Execution Count:1660 | 1660 |
1697 | } executed: } Execution Count:1660 | 1660 |
1698 | emit qApp->focusChanged(prev, focus_widget); executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->focusChanged(prev, focus_widget); | - |
1699 | } executed: } Execution Count:3008 | 3008 |
1700 | } executed: } Execution Count:3011 | 3011 |
1701 | } executed: } Execution Count:3298 | 3298 |
1702 | | - |
1703 | | - |
1704 | /*! | - |
1705 | Returns the application top-level window that has the keyboard input focus, | - |
1706 | or 0 if no application window has the focus. There might be an | - |
1707 | activeWindow() even if there is no focusWidget(), for example if no widget | - |
1708 | in that window accepts key events. | - |
1709 | | - |
1710 | \sa QWidget::setFocus(), QWidget::hasFocus(), focusWidget() | - |
1711 | */ | - |
1712 | | - |
1713 | QWidget *QApplication::activeWindow() | - |
1714 | { | - |
1715 | return QApplicationPrivate::active_window; executed: return QApplicationPrivate::active_window; Execution Count:573032 | 573032 |
1716 | } | - |
1717 | | - |
1718 | /*! | - |
1719 | Returns display (screen) font metrics for the application font. | - |
1720 | | - |
1721 | \sa font(), setFont(), QWidget::fontMetrics(), QPainter::fontMetrics() | - |
1722 | */ | - |
1723 | | - |
1724 | QFontMetrics QApplication::fontMetrics() | - |
1725 | { | - |
1726 | return desktop()->fontMetrics(); never executed: return desktop()->fontMetrics(); | 0 |
1727 | } | - |
1728 | | - |
1729 | | - |
1730 | /*! | - |
1731 | Closes all top-level windows. | - |
1732 | | - |
1733 | This function is particularly useful for applications with many top-level | - |
1734 | windows. It could, for example, be connected to a \uicontrol{Exit} entry in the | - |
1735 | \uicontrol{File} menu: | - |
1736 | | - |
1737 | \snippet mainwindows/mdi/mainwindow.cpp 0 | - |
1738 | | - |
1739 | The windows are closed in random order, until one window does not accept | - |
1740 | the close event. The application quits when the last window was | - |
1741 | successfully closed; this can be turned off by setting | - |
1742 | \l quitOnLastWindowClosed to false. | - |
1743 | | - |
1744 | \sa quitOnLastWindowClosed, lastWindowClosed(), QWidget::close(), | - |
1745 | QWidget::closeEvent(), lastWindowClosed(), quit(), topLevelWidgets(), | - |
1746 | QWidget::isWindow() | - |
1747 | */ | - |
1748 | void QApplication::closeAllWindows() | - |
1749 | { | - |
1750 | bool did_close = true; executed (the execution status of this line is deduced): bool did_close = true; | - |
1751 | QWidget *w; executed (the execution status of this line is deduced): QWidget *w; | - |
1752 | while ((w = activeModalWidget()) && did_close) { evaluated: (w = activeModalWidget()) yes Evaluation Count:3 | yes Evaluation Count:4 |
partially evaluated: did_close yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-4 |
1753 | if (!w->isVisible() || w->data->is_closing) partially evaluated: !w->isVisible() no Evaluation Count:0 | yes Evaluation Count:3 |
partially evaluated: w->data->is_closing no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1754 | break; | 0 |
1755 | did_close = w->close(); executed (the execution status of this line is deduced): did_close = w->close(); | - |
1756 | } executed: } Execution Count:3 | 3 |
1757 | QWidgetList list = QApplication::topLevelWidgets(); executed (the execution status of this line is deduced): QWidgetList list = QApplication::topLevelWidgets(); | - |
1758 | for (int i = 0; did_close && i < list.size(); ++i) { partially evaluated: did_close yes Evaluation Count:41 | no Evaluation Count:0 |
evaluated: i < list.size() yes Evaluation Count:37 | yes Evaluation Count:4 |
| 0-41 |
1759 | w = list.at(i); executed (the execution status of this line is deduced): w = list.at(i); | - |
1760 | if (w->isVisible() evaluated: w->isVisible() yes Evaluation Count:11 | yes Evaluation Count:26 |
| 11-26 |
1761 | && w->windowType() != Qt::Desktop partially evaluated: w->windowType() != Qt::Desktop yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
1762 | && !w->data->is_closing) { evaluated: !w->data->is_closing yes Evaluation Count:9 | yes Evaluation Count:2 |
| 2-9 |
1763 | did_close = w->close(); executed (the execution status of this line is deduced): did_close = w->close(); | - |
1764 | list = QApplication::topLevelWidgets(); executed (the execution status of this line is deduced): list = QApplication::topLevelWidgets(); | - |
1765 | i = -1; executed (the execution status of this line is deduced): i = -1; | - |
1766 | } executed: } Execution Count:9 | 9 |
1767 | } executed: } Execution Count:37 | 37 |
1768 | } executed: } Execution Count:4 | 4 |
1769 | | - |
1770 | /*! | - |
1771 | Displays a simple message box about Qt. The message includes the version | - |
1772 | number of Qt being used by the application. | - |
1773 | | - |
1774 | This is useful for inclusion in the \uicontrol Help menu of an application, as | - |
1775 | shown in the \l{mainwindows/menus}{Menus} example. | - |
1776 | | - |
1777 | This function is a convenience slot for QMessageBox::aboutQt(). | - |
1778 | */ | - |
1779 | void QApplication::aboutQt() | - |
1780 | { | - |
1781 | #ifndef QT_NO_MESSAGEBOX | - |
1782 | QMessageBox::aboutQt(activeWindow()); never executed (the execution status of this line is deduced): QMessageBox::aboutQt(activeWindow()); | - |
1783 | #endif // QT_NO_MESSAGEBOX | - |
1784 | } | 0 |
1785 | | - |
1786 | /*! | - |
1787 | \since 4.1 | - |
1788 | \fn void QApplication::focusChanged(QWidget *old, QWidget *now) | - |
1789 | | - |
1790 | This signal is emitted when the widget that has keyboard focus changed from | - |
1791 | \a old to \a now, i.e., because the user pressed the tab-key, clicked into | - |
1792 | a widget or changed the active window. Both \a old and \a now can be the | - |
1793 | null-pointer. | - |
1794 | | - |
1795 | The signal is emitted after both widget have been notified about the change | - |
1796 | through QFocusEvent. | - |
1797 | | - |
1798 | \sa QWidget::setFocus(), QWidget::clearFocus(), Qt::FocusReason | - |
1799 | */ | - |
1800 | | - |
1801 | /*!\reimp | - |
1802 | | - |
1803 | */ | - |
1804 | bool QApplication::event(QEvent *e) | - |
1805 | { | - |
1806 | Q_D(QApplication); executed (the execution status of this line is deduced): QApplicationPrivate * const d = d_func(); | - |
1807 | if(e->type() == QEvent::Close) { partially evaluated: e->type() == QEvent::Close no Evaluation Count:0 | yes Evaluation Count:2068 |
| 0-2068 |
1808 | QCloseEvent *ce = static_cast<QCloseEvent*>(e); never executed (the execution status of this line is deduced): QCloseEvent *ce = static_cast<QCloseEvent*>(e); | - |
1809 | ce->accept(); never executed (the execution status of this line is deduced): ce->accept(); | - |
1810 | closeAllWindows(); never executed (the execution status of this line is deduced): closeAllWindows(); | - |
1811 | | - |
1812 | QWidgetList list = topLevelWidgets(); never executed (the execution status of this line is deduced): QWidgetList list = topLevelWidgets(); | - |
1813 | for (int i = 0; i < list.size(); ++i) { never evaluated: i < list.size() | 0 |
1814 | QWidget *w = list.at(i); never executed (the execution status of this line is deduced): QWidget *w = list.at(i); | - |
1815 | if (w->isVisible() && !(w->windowType() == Qt::Desktop) && !(w->windowType() == Qt::Popup) && never evaluated: w->isVisible() never evaluated: !(w->windowType() == Qt::Desktop) never evaluated: !(w->windowType() == Qt::Popup) | 0 |
1816 | (!(w->windowType() == Qt::Dialog) || !w->parentWidget())) { never evaluated: !(w->windowType() == Qt::Dialog) never evaluated: !w->parentWidget() | 0 |
1817 | ce->ignore(); never executed (the execution status of this line is deduced): ce->ignore(); | - |
1818 | break; | 0 |
1819 | } | - |
1820 | } | 0 |
1821 | if (ce->isAccepted()) { never evaluated: ce->isAccepted() | 0 |
1822 | return true; never executed: return true; | 0 |
1823 | } | - |
1824 | #ifndef Q_OS_WIN | - |
1825 | } else if (e->type() == QEvent::LocaleChange) { never executed: } partially evaluated: e->type() == QEvent::LocaleChange no Evaluation Count:0 | yes Evaluation Count:2068 |
| 0-2068 |
1826 | // on Windows the event propagation is taken care by the | - |
1827 | // WM_SETTINGCHANGE event handler. | - |
1828 | QWidgetList list = topLevelWidgets(); never executed (the execution status of this line is deduced): QWidgetList list = topLevelWidgets(); | - |
1829 | for (int i = 0; i < list.size(); ++i) { never evaluated: i < list.size() | 0 |
1830 | QWidget *w = list.at(i); never executed (the execution status of this line is deduced): QWidget *w = list.at(i); | - |
1831 | if (!(w->windowType() == Qt::Desktop)) { never evaluated: !(w->windowType() == Qt::Desktop) | 0 |
1832 | if (!w->testAttribute(Qt::WA_SetLocale)) never evaluated: !w->testAttribute(Qt::WA_SetLocale) | 0 |
1833 | w->d_func()->setLocale_helper(QLocale(), true); never executed: w->d_func()->setLocale_helper(QLocale(), true); | 0 |
1834 | } | 0 |
1835 | } | 0 |
1836 | #endif | - |
1837 | } else if (e->type() == QEvent::Timer) { never executed: } evaluated: e->type() == QEvent::Timer yes Evaluation Count:25 | yes Evaluation Count:2043 |
| 0-2043 |
1838 | QTimerEvent *te = static_cast<QTimerEvent*>(e); executed (the execution status of this line is deduced): QTimerEvent *te = static_cast<QTimerEvent*>(e); | - |
1839 | Q_ASSERT(te != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
1840 | if (te->timerId() == d->toolTipWakeUp.timerId()) { evaluated: te->timerId() == d->toolTipWakeUp.timerId() yes Evaluation Count:4 | yes Evaluation Count:21 |
| 4-21 |
1841 | d->toolTipWakeUp.stop(); executed (the execution status of this line is deduced): d->toolTipWakeUp.stop(); | - |
1842 | if (d->toolTipWidget) { evaluated: d->toolTipWidget yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
1843 | QWidget *w = d->toolTipWidget->window(); executed (the execution status of this line is deduced): QWidget *w = d->toolTipWidget->window(); | - |
1844 | // show tooltip if WA_AlwaysShowToolTips is set, or if | - |
1845 | // any ancestor of d->toolTipWidget is the active | - |
1846 | // window | - |
1847 | bool showToolTip = w->testAttribute(Qt::WA_AlwaysShowToolTips); executed (the execution status of this line is deduced): bool showToolTip = w->testAttribute(Qt::WA_AlwaysShowToolTips); | - |
1848 | while (w && !showToolTip) { evaluated: w yes Evaluation Count:3 | yes Evaluation Count:3 |
partially evaluated: !showToolTip yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1849 | showToolTip = w->isActiveWindow(); executed (the execution status of this line is deduced): showToolTip = w->isActiveWindow(); | - |
1850 | w = w->parentWidget(); executed (the execution status of this line is deduced): w = w->parentWidget(); | - |
1851 | w = w ? w->window() : 0; partially evaluated: w no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1852 | } executed: } Execution Count:3 | 3 |
1853 | if (showToolTip) { partially evaluated: showToolTip yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1854 | QHelpEvent e(QEvent::ToolTip, d->toolTipPos, d->toolTipGlobalPos); executed (the execution status of this line is deduced): QHelpEvent e(QEvent::ToolTip, d->toolTipPos, d->toolTipGlobalPos); | - |
1855 | QApplication::sendEvent(d->toolTipWidget, &e); executed (the execution status of this line is deduced): QApplication::sendEvent(d->toolTipWidget, &e); | - |
1856 | if (e.isAccepted()) evaluated: e.isAccepted() yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
1857 | d->toolTipFallAsleep.start(2000, this); executed: d->toolTipFallAsleep.start(2000, this); Execution Count:2 | 2 |
1858 | } executed: } Execution Count:3 | 3 |
1859 | } executed: } Execution Count:3 | 3 |
1860 | } else if (te->timerId() == d->toolTipFallAsleep.timerId()) { executed: } Execution Count:4 evaluated: te->timerId() == d->toolTipFallAsleep.timerId() yes Evaluation Count:1 | yes Evaluation Count:20 |
| 1-20 |
1861 | d->toolTipFallAsleep.stop(); executed (the execution status of this line is deduced): d->toolTipFallAsleep.stop(); | - |
1862 | } executed: } Execution Count:1 | 1 |
1863 | } | - |
1864 | | - |
1865 | if(e->type() == QEvent::LanguageChange) { partially evaluated: e->type() == QEvent::LanguageChange no Evaluation Count:0 | yes Evaluation Count:2068 |
| 0-2068 |
1866 | QWidgetList list = topLevelWidgets(); never executed (the execution status of this line is deduced): QWidgetList list = topLevelWidgets(); | - |
1867 | for (int i = 0; i < list.size(); ++i) { never evaluated: i < list.size() | 0 |
1868 | QWidget *w = list.at(i); never executed (the execution status of this line is deduced): QWidget *w = list.at(i); | - |
1869 | if (!(w->windowType() == Qt::Desktop)) never evaluated: !(w->windowType() == Qt::Desktop) | 0 |
1870 | postEvent(w, new QEvent(QEvent::LanguageChange)); never executed: postEvent(w, new QEvent(QEvent::LanguageChange)); | 0 |
1871 | } | 0 |
1872 | } | 0 |
1873 | | - |
1874 | return QGuiApplication::event(e); executed: return QGuiApplication::event(e); Execution Count:2068 | 2068 |
1875 | } | - |
1876 | | - |
1877 | /*! | - |
1878 | \fn void QApplication::syncX() | - |
1879 | Was used to synchronize with the X server in 4.x, here for source compatibility. | - |
1880 | \internal | - |
1881 | \obsolete | - |
1882 | */ | - |
1883 | | - |
1884 | void QApplicationPrivate::notifyLayoutDirectionChange() | - |
1885 | { | - |
1886 | QWidgetList list = QApplication::topLevelWidgets(); executed (the execution status of this line is deduced): QWidgetList list = QApplication::topLevelWidgets(); | - |
1887 | for (int i = 0; i < list.size(); ++i) { evaluated: i < list.size() yes Evaluation Count:154 | yes Evaluation Count:11 |
| 11-154 |
1888 | QWidget *w = list.at(i); executed (the execution status of this line is deduced): QWidget *w = list.at(i); | - |
1889 | QEvent ev(QEvent::ApplicationLayoutDirectionChange); executed (the execution status of this line is deduced): QEvent ev(QEvent::ApplicationLayoutDirectionChange); | - |
1890 | QCoreApplication::sendEvent(w, &ev); executed (the execution status of this line is deduced): QCoreApplication::sendEvent(w, &ev); | - |
1891 | } executed: } Execution Count:154 | 154 |
1892 | } executed: } Execution Count:11 | 11 |
1893 | | - |
1894 | /*! | - |
1895 | \fn void QApplication::setActiveWindow(QWidget* active) | - |
1896 | | - |
1897 | Sets the active window to the \a active widget in response to a system | - |
1898 | event. The function is called from the platform specific event handlers. | - |
1899 | | - |
1900 | \warning This function does \e not set the keyboard focus to the active | - |
1901 | widget. Call QWidget::activateWindow() instead. | - |
1902 | | - |
1903 | It sets the activeWindow() and focusWidget() attributes and sends proper | - |
1904 | \l{QEvent::WindowActivate}{WindowActivate}/\l{QEvent::WindowDeactivate} | - |
1905 | {WindowDeactivate} and \l{QEvent::FocusIn}{FocusIn}/\l{QEvent::FocusOut} | - |
1906 | {FocusOut} events to all appropriate widgets. The window will then be | - |
1907 | painted in active state (e.g. cursors in line edits will blink), and it | - |
1908 | will have tool tips enabled. | - |
1909 | | - |
1910 | \sa activeWindow(), QWidget::activateWindow() | - |
1911 | */ | - |
1912 | void QApplication::setActiveWindow(QWidget* act) | - |
1913 | { | - |
1914 | QWidget* window = act?act->window():0; evaluated: act yes Evaluation Count:1893 | yes Evaluation Count:1393 |
| 1393-1893 |
1915 | | - |
1916 | if (QApplicationPrivate::active_window == window) evaluated: QApplicationPrivate::active_window == window yes Evaluation Count:235 | yes Evaluation Count:3051 |
| 235-3051 |
1917 | return; executed: return; Execution Count:235 | 235 |
1918 | | - |
1919 | #ifndef QT_NO_GRAPHICSVIEW | - |
1920 | if (window && window->graphicsProxyWidget()) { evaluated: window yes Evaluation Count:1700 | yes Evaluation Count:1351 |
partially evaluated: window->graphicsProxyWidget() no Evaluation Count:0 | yes Evaluation Count:1700 |
| 0-1700 |
1921 | // Activate the proxy's view->viewport() ? | - |
1922 | return; | 0 |
1923 | } | - |
1924 | #endif | - |
1925 | | - |
1926 | QWidgetList toBeActivated; executed (the execution status of this line is deduced): QWidgetList toBeActivated; | - |
1927 | QWidgetList toBeDeactivated; executed (the execution status of this line is deduced): QWidgetList toBeDeactivated; | - |
1928 | | - |
1929 | if (QApplicationPrivate::active_window) { evaluated: QApplicationPrivate::active_window yes Evaluation Count:1699 | yes Evaluation Count:1352 |
| 1352-1699 |
1930 | if (style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, QApplicationPrivate::active_window)) { partially evaluated: style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, QApplicationPrivate::active_window) no Evaluation Count:0 | yes Evaluation Count:1699 |
| 0-1699 |
1931 | QWidgetList list = topLevelWidgets(); never executed (the execution status of this line is deduced): QWidgetList list = topLevelWidgets(); | - |
1932 | for (int i = 0; i < list.size(); ++i) { never evaluated: i < list.size() | 0 |
1933 | QWidget *w = list.at(i); never executed (the execution status of this line is deduced): QWidget *w = list.at(i); | - |
1934 | if (w->isVisible() && w->isActiveWindow()) never evaluated: w->isVisible() never evaluated: w->isActiveWindow() | 0 |
1935 | toBeDeactivated.append(w); never executed: toBeDeactivated.append(w); | 0 |
1936 | } | 0 |
1937 | } else { | 0 |
1938 | toBeDeactivated.append(QApplicationPrivate::active_window); executed (the execution status of this line is deduced): toBeDeactivated.append(QApplicationPrivate::active_window); | - |
1939 | } executed: } Execution Count:1699 | 1699 |
1940 | } | - |
1941 | | - |
1942 | if (QApplicationPrivate::focus_widget) { evaluated: QApplicationPrivate::focus_widget yes Evaluation Count:433 | yes Evaluation Count:2618 |
| 433-2618 |
1943 | if (QApplicationPrivate::focus_widget->testAttribute(Qt::WA_InputMethodEnabled)) evaluated: QApplicationPrivate::focus_widget->testAttribute(Qt::WA_InputMethodEnabled) yes Evaluation Count:229 | yes Evaluation Count:204 |
| 204-229 |
1944 | qApp->inputMethod()->commit(); executed: (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->commit(); Execution Count:229 | 229 |
1945 | | - |
1946 | QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange, Qt::ActiveWindowFocusReason); executed (the execution status of this line is deduced): QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange, Qt::ActiveWindowFocusReason); | - |
1947 | QApplication::sendEvent(QApplicationPrivate::focus_widget, &focusAboutToChange); executed (the execution status of this line is deduced): QApplication::sendEvent(QApplicationPrivate::focus_widget, &focusAboutToChange); | - |
1948 | } executed: } Execution Count:433 | 433 |
1949 | | - |
1950 | QApplicationPrivate::active_window = window; executed (the execution status of this line is deduced): QApplicationPrivate::active_window = window; | - |
1951 | | - |
1952 | if (QApplicationPrivate::active_window) { evaluated: QApplicationPrivate::active_window yes Evaluation Count:1700 | yes Evaluation Count:1351 |
| 1351-1700 |
1953 | if (style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, QApplicationPrivate::active_window)) { partially evaluated: style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, QApplicationPrivate::active_window) no Evaluation Count:0 | yes Evaluation Count:1700 |
| 0-1700 |
1954 | QWidgetList list = topLevelWidgets(); never executed (the execution status of this line is deduced): QWidgetList list = topLevelWidgets(); | - |
1955 | for (int i = 0; i < list.size(); ++i) { never evaluated: i < list.size() | 0 |
1956 | QWidget *w = list.at(i); never executed (the execution status of this line is deduced): QWidget *w = list.at(i); | - |
1957 | if (w->isVisible() && w->isActiveWindow()) never evaluated: w->isVisible() never evaluated: w->isActiveWindow() | 0 |
1958 | toBeActivated.append(w); never executed: toBeActivated.append(w); | 0 |
1959 | } | 0 |
1960 | } else { | 0 |
1961 | toBeActivated.append(QApplicationPrivate::active_window); executed (the execution status of this line is deduced): toBeActivated.append(QApplicationPrivate::active_window); | - |
1962 | } executed: } Execution Count:1700 | 1700 |
1963 | | - |
1964 | } | - |
1965 | | - |
1966 | // first the activation/deactivation events | - |
1967 | QEvent activationChange(QEvent::ActivationChange); executed (the execution status of this line is deduced): QEvent activationChange(QEvent::ActivationChange); | - |
1968 | QEvent windowActivate(QEvent::WindowActivate); executed (the execution status of this line is deduced): QEvent windowActivate(QEvent::WindowActivate); | - |
1969 | QEvent windowDeactivate(QEvent::WindowDeactivate); executed (the execution status of this line is deduced): QEvent windowDeactivate(QEvent::WindowDeactivate); | - |
1970 | | - |
1971 | for (int i = 0; i < toBeActivated.size(); ++i) { evaluated: i < toBeActivated.size() yes Evaluation Count:1700 | yes Evaluation Count:3051 |
| 1700-3051 |
1972 | QWidget *w = toBeActivated.at(i); executed (the execution status of this line is deduced): QWidget *w = toBeActivated.at(i); | - |
1973 | sendSpontaneousEvent(w, &windowActivate); executed (the execution status of this line is deduced): sendSpontaneousEvent(w, &windowActivate); | - |
1974 | sendSpontaneousEvent(w, &activationChange); executed (the execution status of this line is deduced): sendSpontaneousEvent(w, &activationChange); | - |
1975 | } executed: } Execution Count:1700 | 1700 |
1976 | | - |
1977 | for(int i = 0; i < toBeDeactivated.size(); ++i) { evaluated: i < toBeDeactivated.size() yes Evaluation Count:1699 | yes Evaluation Count:3051 |
| 1699-3051 |
1978 | QWidget *w = toBeDeactivated.at(i); executed (the execution status of this line is deduced): QWidget *w = toBeDeactivated.at(i); | - |
1979 | sendSpontaneousEvent(w, &windowDeactivate); executed (the execution status of this line is deduced): sendSpontaneousEvent(w, &windowDeactivate); | - |
1980 | sendSpontaneousEvent(w, &activationChange); executed (the execution status of this line is deduced): sendSpontaneousEvent(w, &activationChange); | - |
1981 | } executed: } Execution Count:1699 | 1699 |
1982 | | - |
1983 | if (QApplicationPrivate::popupWidgets == 0) { // !inPopupMode() evaluated: QApplicationPrivate::popupWidgets == 0 yes Evaluation Count:3039 | yes Evaluation Count:12 |
| 12-3039 |
1984 | // then focus events | - |
1985 | if (!QApplicationPrivate::active_window && QApplicationPrivate::focus_widget) { evaluated: !QApplicationPrivate::active_window yes Evaluation Count:1339 | yes Evaluation Count:1700 |
evaluated: QApplicationPrivate::focus_widget yes Evaluation Count:196 | yes Evaluation Count:1143 |
| 196-1700 |
1986 | QApplicationPrivate::setFocusWidget(0, Qt::ActiveWindowFocusReason); executed (the execution status of this line is deduced): QApplicationPrivate::setFocusWidget(0, Qt::ActiveWindowFocusReason); | - |
1987 | } else if (QApplicationPrivate::active_window) { executed: } Execution Count:196 evaluated: QApplicationPrivate::active_window yes Evaluation Count:1700 | yes Evaluation Count:1143 |
| 196-1700 |
1988 | QWidget *w = QApplicationPrivate::active_window->focusWidget(); executed (the execution status of this line is deduced): QWidget *w = QApplicationPrivate::active_window->focusWidget(); | - |
1989 | if (w && w->isVisible() /*&& w->focusPolicy() != QWidget::NoFocus*/) evaluated: w yes Evaluation Count:266 | yes Evaluation Count:1434 |
evaluated: w->isVisible() yes Evaluation Count:262 | yes Evaluation Count:4 |
| 4-1434 |
1990 | w->setFocus(Qt::ActiveWindowFocusReason); executed: w->setFocus(Qt::ActiveWindowFocusReason); Execution Count:262 | 262 |
1991 | else { | - |
1992 | w = QApplicationPrivate::focusNextPrevChild_helper(QApplicationPrivate::active_window, true); executed (the execution status of this line is deduced): w = QApplicationPrivate::focusNextPrevChild_helper(QApplicationPrivate::active_window, true); | - |
1993 | if (w) { evaluated: w yes Evaluation Count:228 | yes Evaluation Count:1210 |
| 228-1210 |
1994 | w->setFocus(Qt::ActiveWindowFocusReason); executed (the execution status of this line is deduced): w->setFocus(Qt::ActiveWindowFocusReason); | - |
1995 | } else { executed: } Execution Count:228 | 228 |
1996 | // If the focus widget is not in the activate_window, clear the focus | - |
1997 | w = QApplicationPrivate::focus_widget; executed (the execution status of this line is deduced): w = QApplicationPrivate::focus_widget; | - |
1998 | if (!w && QApplicationPrivate::active_window->focusPolicy() != Qt::NoFocus) evaluated: !w yes Evaluation Count:1062 | yes Evaluation Count:148 |
evaluated: QApplicationPrivate::active_window->focusPolicy() != Qt::NoFocus yes Evaluation Count:775 | yes Evaluation Count:287 |
| 148-1062 |
1999 | QApplicationPrivate::setFocusWidget(QApplicationPrivate::active_window, Qt::ActiveWindowFocusReason); executed: QApplicationPrivate::setFocusWidget(QApplicationPrivate::active_window, Qt::ActiveWindowFocusReason); Execution Count:775 | 775 |
2000 | else if (!QApplicationPrivate::active_window->isAncestorOf(w)) partially evaluated: !QApplicationPrivate::active_window->isAncestorOf(w) yes Evaluation Count:435 | no Evaluation Count:0 |
| 0-435 |
2001 | QApplicationPrivate::setFocusWidget(0, Qt::ActiveWindowFocusReason); executed: QApplicationPrivate::setFocusWidget(0, Qt::ActiveWindowFocusReason); Execution Count:435 | 435 |
2002 | } | - |
2003 | } | - |
2004 | } | - |
2005 | } | - |
2006 | } executed: } Execution Count:3051 | 3051 |
2007 | | - |
2008 | /*!internal | - |
2009 | * Helper function that returns the new focus widget, but does not set the focus reason. | - |
2010 | * Returns 0 if a new focus widget could not be found. | - |
2011 | * Shared with QGraphicsProxyWidgetPrivate::findFocusChild() | - |
2012 | */ | - |
2013 | QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool next) | - |
2014 | { | - |
2015 | uint focus_flag = qt_tab_all_widgets() ? Qt::TabFocus : Qt::StrongFocus; partially evaluated: qt_tab_all_widgets() yes Evaluation Count:1752 | no Evaluation Count:0 |
| 0-1752 |
2016 | | - |
2017 | QWidget *f = toplevel->focusWidget(); executed (the execution status of this line is deduced): QWidget *f = toplevel->focusWidget(); | - |
2018 | if (!f) evaluated: !f yes Evaluation Count:1438 | yes Evaluation Count:314 |
| 314-1438 |
2019 | f = toplevel; executed: f = toplevel; Execution Count:1438 | 1438 |
2020 | | - |
2021 | QWidget *w = f; executed (the execution status of this line is deduced): QWidget *w = f; | - |
2022 | QWidget *test = f->d_func()->focus_next; executed (the execution status of this line is deduced): QWidget *test = f->d_func()->focus_next; | - |
2023 | while (test && test != f) { partially evaluated: test yes Evaluation Count:12192 | no Evaluation Count:0 |
evaluated: test != f yes Evaluation Count:10707 | yes Evaluation Count:1485 |
| 0-12192 |
2024 | if ((test->focusPolicy() & focus_flag) == focus_flag evaluated: (test->focusPolicy() & focus_flag) == focus_flag yes Evaluation Count:2046 | yes Evaluation Count:8661 |
| 2046-8661 |
2025 | && !(test->d_func()->extra && test->d_func()->extra->focus_proxy) evaluated: test->d_func()->extra yes Evaluation Count:1080 | yes Evaluation Count:966 |
evaluated: test->d_func()->extra->focus_proxy yes Evaluation Count:653 | yes Evaluation Count:427 |
| 427-1080 |
2026 | && test->isVisibleTo(toplevel) && test->isEnabled() evaluated: test->isVisibleTo(toplevel) yes Evaluation Count:677 | yes Evaluation Count:716 |
evaluated: test->isEnabled() yes Evaluation Count:674 | yes Evaluation Count:3 |
| 3-716 |
2027 | && !(w->windowType() == Qt::SubWindow && !w->isAncestorOf(test)) evaluated: w->windowType() == Qt::SubWindow yes Evaluation Count:184 | yes Evaluation Count:490 |
evaluated: !w->isAncestorOf(test) yes Evaluation Count:177 | yes Evaluation Count:7 |
| 7-490 |
2028 | && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))) { evaluated: toplevel->windowType() != Qt::SubWindow yes Evaluation Count:266 | yes Evaluation Count:231 |
evaluated: toplevel->isAncestorOf(test) yes Evaluation Count:17 | yes Evaluation Count:214 |
| 17-266 |
2029 | w = test; executed (the execution status of this line is deduced): w = test; | - |
2030 | if (next) evaluated: next yes Evaluation Count:267 | yes Evaluation Count:16 |
| 16-267 |
2031 | break; executed: break; Execution Count:267 | 267 |
2032 | } executed: } Execution Count:16 | 16 |
2033 | test = test->d_func()->focus_next; executed (the execution status of this line is deduced): test = test->d_func()->focus_next; | - |
2034 | } executed: } Execution Count:10440 | 10440 |
2035 | if (w == f) { evaluated: w == f yes Evaluation Count:1473 | yes Evaluation Count:279 |
| 279-1473 |
2036 | if (qt_in_tab_key_event) { evaluated: qt_in_tab_key_event yes Evaluation Count:13 | yes Evaluation Count:1460 |
| 13-1460 |
2037 | w->window()->setAttribute(Qt::WA_KeyboardFocusChange); executed (the execution status of this line is deduced): w->window()->setAttribute(Qt::WA_KeyboardFocusChange); | - |
2038 | w->update(); executed (the execution status of this line is deduced): w->update(); | - |
2039 | } executed: } Execution Count:13 | 13 |
2040 | return 0; executed: return 0; Execution Count:1473 | 1473 |
2041 | } | - |
2042 | return w; executed: return w; Execution Count:279 | 279 |
2043 | } | - |
2044 | | - |
2045 | /*! | - |
2046 | \fn void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, const QPointF &globalPosF) | - |
2047 | \internal | - |
2048 | | - |
2049 | Creates the proper Enter/Leave event when widget \a enter is entered and | - |
2050 | widget \a leave is left. | - |
2051 | */ | - |
2052 | void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, const QPointF &globalPosF) | - |
2053 | { | - |
2054 | const QPoint globalPos = globalPosF.toPoint(); executed (the execution status of this line is deduced): const QPoint globalPos = globalPosF.toPoint(); | - |
2055 | #if 0 | - |
2056 | if (leave) { | - |
2057 | QEvent e(QEvent::Leave); | - |
2058 | QApplication::sendEvent(leave, & e); | - |
2059 | } | - |
2060 | if (enter) { | - |
2061 | const QPoint windowPos = enter->window()->mapFromGlobal(globalPos); | - |
2062 | QEnterEvent e(enter->mapFromGlobal(globalPos), windowPos, globalPos); | - |
2063 | QApplication::sendEvent(enter, & e); | - |
2064 | } | - |
2065 | return; | - |
2066 | #endif | - |
2067 | | - |
2068 | QWidget* w ; executed (the execution status of this line is deduced): QWidget* w ; | - |
2069 | if ((!enter && !leave) || (enter == leave)) evaluated: !enter yes Evaluation Count:518 | yes Evaluation Count:1834 |
partially evaluated: !leave no Evaluation Count:0 | yes Evaluation Count:518 |
evaluated: (enter == leave) yes Evaluation Count:181 | yes Evaluation Count:2171 |
| 0-2171 |
2070 | return; executed: return; Execution Count:181 | 181 |
2071 | #ifdef ALIEN_DEBUG | - |
2072 | qDebug() << "QApplicationPrivate::dispatchEnterLeave, ENTER:" << enter << "LEAVE:" << leave; | - |
2073 | #endif | - |
2074 | QWidgetList leaveList; executed (the execution status of this line is deduced): QWidgetList leaveList; | - |
2075 | QWidgetList enterList; executed (the execution status of this line is deduced): QWidgetList enterList; | - |
2076 | | - |
2077 | bool sameWindow = leave && enter && leave->window() == enter->window(); evaluated: leave yes Evaluation Count:737 | yes Evaluation Count:1434 |
evaluated: enter yes Evaluation Count:219 | yes Evaluation Count:518 |
partially evaluated: leave->window() == enter->window() yes Evaluation Count:219 | no Evaluation Count:0 |
| 0-1434 |
2078 | if (leave && !sameWindow) { evaluated: leave yes Evaluation Count:737 | yes Evaluation Count:1434 |
evaluated: !sameWindow yes Evaluation Count:518 | yes Evaluation Count:219 |
| 219-1434 |
2079 | w = leave; executed (the execution status of this line is deduced): w = leave; | - |
2080 | do { | - |
2081 | leaveList.append(w); executed (the execution status of this line is deduced): leaveList.append(w); | - |
2082 | } while (!w->isWindow() && (w = w->parentWidget())); executed: } Execution Count:650 evaluated: !w->isWindow() yes Evaluation Count:132 | yes Evaluation Count:518 |
partially evaluated: (w = w->parentWidget()) yes Evaluation Count:132 | no Evaluation Count:0 |
| 0-650 |
2083 | } executed: } Execution Count:518 | 518 |
2084 | if (enter && !sameWindow) { evaluated: enter yes Evaluation Count:1653 | yes Evaluation Count:518 |
evaluated: !sameWindow yes Evaluation Count:1434 | yes Evaluation Count:219 |
| 219-1653 |
2085 | w = enter; executed (the execution status of this line is deduced): w = enter; | - |
2086 | do { | - |
2087 | enterList.prepend(w); executed (the execution status of this line is deduced): enterList.prepend(w); | - |
2088 | } while (!w->isWindow() && (w = w->parentWidget())); executed: } Execution Count:2652 evaluated: !w->isWindow() yes Evaluation Count:1218 | yes Evaluation Count:1434 |
partially evaluated: (w = w->parentWidget()) yes Evaluation Count:1218 | no Evaluation Count:0 |
| 0-2652 |
2089 | } executed: } Execution Count:1434 | 1434 |
2090 | if (sameWindow) { evaluated: sameWindow yes Evaluation Count:219 | yes Evaluation Count:1952 |
| 219-1952 |
2091 | int enterDepth = 0; executed (the execution status of this line is deduced): int enterDepth = 0; | - |
2092 | int leaveDepth = 0; executed (the execution status of this line is deduced): int leaveDepth = 0; | - |
2093 | w = enter; executed (the execution status of this line is deduced): w = enter; | - |
2094 | while (!w->isWindow() && (w = w->parentWidget())) evaluated: !w->isWindow() yes Evaluation Count:330 | yes Evaluation Count:219 |
partially evaluated: (w = w->parentWidget()) yes Evaluation Count:330 | no Evaluation Count:0 |
| 0-330 |
2095 | enterDepth++; executed: enterDepth++; Execution Count:330 | 330 |
2096 | w = leave; executed (the execution status of this line is deduced): w = leave; | - |
2097 | while (!w->isWindow() && (w = w->parentWidget())) evaluated: !w->isWindow() yes Evaluation Count:451 | yes Evaluation Count:219 |
partially evaluated: (w = w->parentWidget()) yes Evaluation Count:451 | no Evaluation Count:0 |
| 0-451 |
2098 | leaveDepth++; executed: leaveDepth++; Execution Count:451 | 451 |
2099 | QWidget* wenter = enter; executed (the execution status of this line is deduced): QWidget* wenter = enter; | - |
2100 | QWidget* wleave = leave; executed (the execution status of this line is deduced): QWidget* wleave = leave; | - |
2101 | while (enterDepth > leaveDepth) { evaluated: enterDepth > leaveDepth yes Evaluation Count:130 | yes Evaluation Count:219 |
| 130-219 |
2102 | wenter = wenter->parentWidget(); executed (the execution status of this line is deduced): wenter = wenter->parentWidget(); | - |
2103 | enterDepth--; executed (the execution status of this line is deduced): enterDepth--; | - |
2104 | } executed: } Execution Count:130 | 130 |
2105 | while (leaveDepth > enterDepth) { evaluated: leaveDepth > enterDepth yes Evaluation Count:251 | yes Evaluation Count:219 |
| 219-251 |
2106 | wleave = wleave->parentWidget(); executed (the execution status of this line is deduced): wleave = wleave->parentWidget(); | - |
2107 | leaveDepth--; executed (the execution status of this line is deduced): leaveDepth--; | - |
2108 | } executed: } Execution Count:251 | 251 |
2109 | while (!wenter->isWindow() && wenter != wleave) { evaluated: !wenter->isWindow() yes Evaluation Count:136 | yes Evaluation Count:148 |
evaluated: wenter != wleave yes Evaluation Count:65 | yes Evaluation Count:71 |
| 65-148 |
2110 | wenter = wenter->parentWidget(); executed (the execution status of this line is deduced): wenter = wenter->parentWidget(); | - |
2111 | wleave = wleave->parentWidget(); executed (the execution status of this line is deduced): wleave = wleave->parentWidget(); | - |
2112 | } executed: } Execution Count:65 | 65 |
2113 | | - |
2114 | w = leave; executed (the execution status of this line is deduced): w = leave; | - |
2115 | while (w != wleave) { evaluated: w != wleave yes Evaluation Count:316 | yes Evaluation Count:219 |
| 219-316 |
2116 | leaveList.append(w); executed (the execution status of this line is deduced): leaveList.append(w); | - |
2117 | w = w->parentWidget(); executed (the execution status of this line is deduced): w = w->parentWidget(); | - |
2118 | } executed: } Execution Count:316 | 316 |
2119 | w = enter; executed (the execution status of this line is deduced): w = enter; | - |
2120 | while (w != wenter) { evaluated: w != wenter yes Evaluation Count:195 | yes Evaluation Count:219 |
| 195-219 |
2121 | enterList.prepend(w); executed (the execution status of this line is deduced): enterList.prepend(w); | - |
2122 | w = w->parentWidget(); executed (the execution status of this line is deduced): w = w->parentWidget(); | - |
2123 | } executed: } Execution Count:195 | 195 |
2124 | } executed: } Execution Count:219 | 219 |
2125 | | - |
2126 | QEvent leaveEvent(QEvent::Leave); executed (the execution status of this line is deduced): QEvent leaveEvent(QEvent::Leave); | - |
2127 | for (int i = 0; i < leaveList.size(); ++i) { evaluated: i < leaveList.size() yes Evaluation Count:966 | yes Evaluation Count:2171 |
| 966-2171 |
2128 | w = leaveList.at(i); executed (the execution status of this line is deduced): w = leaveList.at(i); | - |
2129 | if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) { evaluated: !QApplication::activeModalWidget() yes Evaluation Count:939 | yes Evaluation Count:27 |
evaluated: QApplicationPrivate::tryModalHelper(w, 0) yes Evaluation Count:25 | yes Evaluation Count:2 |
| 2-939 |
2130 | QApplication::sendEvent(w, &leaveEvent); executed (the execution status of this line is deduced): QApplication::sendEvent(w, &leaveEvent); | - |
2131 | if (w->testAttribute(Qt::WA_Hover) && evaluated: w->testAttribute(Qt::WA_Hover) yes Evaluation Count:6 | yes Evaluation Count:958 |
| 6-958 |
2132 | (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) { partially evaluated: !QApplication::activePopupWidget() yes Evaluation Count:6 | no Evaluation Count:0 |
never evaluated: QApplication::activePopupWidget() == w->window() | 0-6 |
2133 | Q_ASSERT(instance()); executed (the execution status of this line is deduced): qt_noop(); | - |
2134 | QHoverEvent he(QEvent::HoverLeave, QPoint(-1, -1), w->mapFromGlobal(QApplicationPrivate::instance()->hoverGlobalPos), executed (the execution status of this line is deduced): QHoverEvent he(QEvent::HoverLeave, QPoint(-1, -1), w->mapFromGlobal(QApplicationPrivate::instance()->hoverGlobalPos), | - |
2135 | QApplication::keyboardModifiers()); executed (the execution status of this line is deduced): QApplication::keyboardModifiers()); | - |
2136 | qApp->d_func()->notify_helper(w, &he); executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->notify_helper(w, &he); | - |
2137 | } executed: } Execution Count:6 | 6 |
2138 | } executed: } Execution Count:964 | 964 |
2139 | } executed: } Execution Count:966 | 966 |
2140 | if (!enterList.isEmpty()) { evaluated: !enterList.isEmpty() yes Evaluation Count:1530 | yes Evaluation Count:641 |
| 641-1530 |
2141 | const QPoint windowPos = enterList.front()->window()->mapFromGlobal(globalPos); executed (the execution status of this line is deduced): const QPoint windowPos = enterList.front()->window()->mapFromGlobal(globalPos); | - |
2142 | for (int i = 0; i < enterList.size(); ++i) { evaluated: i < enterList.size() yes Evaluation Count:2847 | yes Evaluation Count:1530 |
| 1530-2847 |
2143 | w = enterList.at(i); executed (the execution status of this line is deduced): w = enterList.at(i); | - |
2144 | if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) { evaluated: !QApplication::activeModalWidget() yes Evaluation Count:2758 | yes Evaluation Count:89 |
partially evaluated: QApplicationPrivate::tryModalHelper(w, 0) yes Evaluation Count:89 | no Evaluation Count:0 |
| 0-2758 |
2145 | const QPointF localPos = w->mapFromGlobal(globalPos); executed (the execution status of this line is deduced): const QPointF localPos = w->mapFromGlobal(globalPos); | - |
2146 | QEnterEvent enterEvent(localPos, windowPos, globalPosF); executed (the execution status of this line is deduced): QEnterEvent enterEvent(localPos, windowPos, globalPosF); | - |
2147 | QApplication::sendEvent(w, &enterEvent); executed (the execution status of this line is deduced): QApplication::sendEvent(w, &enterEvent); | - |
2148 | if (w->testAttribute(Qt::WA_Hover) && evaluated: w->testAttribute(Qt::WA_Hover) yes Evaluation Count:26 | yes Evaluation Count:2821 |
| 26-2821 |
2149 | (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) { evaluated: !QApplication::activePopupWidget() yes Evaluation Count:25 | yes Evaluation Count:1 |
partially evaluated: QApplication::activePopupWidget() == w->window() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-25 |
2150 | QHoverEvent he(QEvent::HoverEnter, localPos, QPoint(-1, -1), executed (the execution status of this line is deduced): QHoverEvent he(QEvent::HoverEnter, localPos, QPoint(-1, -1), | - |
2151 | QApplication::keyboardModifiers()); executed (the execution status of this line is deduced): QApplication::keyboardModifiers()); | - |
2152 | qApp->d_func()->notify_helper(w, &he); executed (the execution status of this line is deduced): (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->notify_helper(w, &he); | - |
2153 | } executed: } Execution Count:25 | 25 |
2154 | } executed: } Execution Count:2847 | 2847 |
2155 | } executed: } Execution Count:2847 | 2847 |
2156 | } executed: } Execution Count:1530 | 1530 |
2157 | | - |
2158 | #ifndef QT_NO_CURSOR | - |
2159 | // Update cursor for alien/graphics widgets. | - |
2160 | | - |
2161 | const bool enterOnAlien = (enter && (isAlien(enter) || enter->testAttribute(Qt::WA_DontShowOnScreen))); evaluated: enter yes Evaluation Count:1653 | yes Evaluation Count:518 |
evaluated: isAlien(enter) yes Evaluation Count:1042 | yes Evaluation Count:611 |
partially evaluated: enter->testAttribute(Qt::WA_DontShowOnScreen) no Evaluation Count:0 | yes Evaluation Count:611 |
| 0-1653 |
2162 | // Whenever we leave an alien widget on X11/QPA, we need to reset its nativeParentWidget()'s cursor. | - |
2163 | // This is not required on Windows as the cursor is reset on every single mouse move. | - |
2164 | QWidget *parentOfLeavingCursor = 0; executed (the execution status of this line is deduced): QWidget *parentOfLeavingCursor = 0; | - |
2165 | for (int i = 0; i < leaveList.size(); ++i) { evaluated: i < leaveList.size() yes Evaluation Count:966 | yes Evaluation Count:1653 |
| 966-1653 |
2166 | w = leaveList.at(i); executed (the execution status of this line is deduced): w = leaveList.at(i); | - |
2167 | if (!isAlien(w)) evaluated: !isAlien(w) yes Evaluation Count:518 | yes Evaluation Count:448 |
| 448-518 |
2168 | break; executed: break; Execution Count:518 | 518 |
2169 | if (w->testAttribute(Qt::WA_SetCursor)) { evaluated: w->testAttribute(Qt::WA_SetCursor) yes Evaluation Count:48 | yes Evaluation Count:400 |
| 48-400 |
2170 | QWidget *parent = w->parentWidget(); executed (the execution status of this line is deduced): QWidget *parent = w->parentWidget(); | - |
2171 | while (parent && parent->d_func()->data.in_destructor) partially evaluated: parent yes Evaluation Count:50 | no Evaluation Count:0 |
evaluated: parent->d_func()->data.in_destructor yes Evaluation Count:2 | yes Evaluation Count:48 |
| 0-50 |
2172 | parent = parent->parentWidget(); executed: parent = parent->parentWidget(); Execution Count:2 | 2 |
2173 | parentOfLeavingCursor = parent; executed (the execution status of this line is deduced): parentOfLeavingCursor = parent; | - |
2174 | //continue looping, we need to find the downest alien widget with a cursor. | - |
2175 | // (downest on the screen) | - |
2176 | } executed: } Execution Count:48 | 48 |
2177 | } executed: } Execution Count:448 | 448 |
2178 | //check that we will not call qt_x11_enforce_cursor twice with the same native widget | - |
2179 | if (parentOfLeavingCursor && (!enterOnAlien evaluated: parentOfLeavingCursor yes Evaluation Count:48 | yes Evaluation Count:2123 |
evaluated: !enterOnAlien yes Evaluation Count:5 | yes Evaluation Count:43 |
| 5-2123 |
2180 | || parentOfLeavingCursor->effectiveWinId() != enter->effectiveWinId())) { partially evaluated: parentOfLeavingCursor->effectiveWinId() != enter->effectiveWinId() no Evaluation Count:0 | yes Evaluation Count:43 |
| 0-43 |
2181 | #ifndef QT_NO_GRAPHICSVIEW | - |
2182 | if (!parentOfLeavingCursor->window()->graphicsProxyWidget()) partially evaluated: !parentOfLeavingCursor->window()->graphicsProxyWidget() yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
2183 | #endif | - |
2184 | { | - |
2185 | if (enter == QApplication::desktop()) { partially evaluated: enter == QApplication::desktop() no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
2186 | qt_qpa_set_cursor(enter, true); never executed (the execution status of this line is deduced): qt_qpa_set_cursor(enter, true); | - |
2187 | } else { | 0 |
2188 | qt_qpa_set_cursor(parentOfLeavingCursor, true); executed (the execution status of this line is deduced): qt_qpa_set_cursor(parentOfLeavingCursor, true); | - |
2189 | } executed: } Execution Count:5 | 5 |
2190 | } | - |
2191 | } executed: } Execution Count:5 | 5 |
2192 | if (enterOnAlien) { evaluated: enterOnAlien yes Evaluation Count:1042 | yes Evaluation Count:1129 |
| 1042-1129 |
2193 | QWidget *cursorWidget = enter; executed (the execution status of this line is deduced): QWidget *cursorWidget = enter; | - |
2194 | while (!cursorWidget->isWindow() && !cursorWidget->isEnabled()) partially evaluated: !cursorWidget->isWindow() yes Evaluation Count:1042 | no Evaluation Count:0 |
partially evaluated: !cursorWidget->isEnabled() no Evaluation Count:0 | yes Evaluation Count:1042 |
| 0-1042 |
2195 | cursorWidget = cursorWidget->parentWidget(); never executed: cursorWidget = cursorWidget->parentWidget(); | 0 |
2196 | | - |
2197 | if (!cursorWidget) partially evaluated: !cursorWidget no Evaluation Count:0 | yes Evaluation Count:1042 |
| 0-1042 |
2198 | return; | 0 |
2199 | | - |
2200 | #ifndef QT_NO_GRAPHICSVIEW | - |
2201 | if (cursorWidget->window()->graphicsProxyWidget()) { partially evaluated: cursorWidget->window()->graphicsProxyWidget() no Evaluation Count:0 | yes Evaluation Count:1042 |
| 0-1042 |
2202 | QWidgetPrivate::nearestGraphicsProxyWidget(cursorWidget)->setCursor(cursorWidget->cursor()); never executed (the execution status of this line is deduced): QWidgetPrivate::nearestGraphicsProxyWidget(cursorWidget)->setCursor(cursorWidget->cursor()); | - |
2203 | } else | 0 |
2204 | #endif | - |
2205 | { | - |
2206 | qt_qpa_set_cursor(cursorWidget, true); executed (the execution status of this line is deduced): qt_qpa_set_cursor(cursorWidget, true); | - |
2207 | } executed: } Execution Count:1042 | 1042 |
2208 | } | - |
2209 | #endif | - |
2210 | } executed: } Execution Count:2171 | 2171 |
2211 | | - |
2212 | /* exported for the benefit of testing tools */ | - |
2213 | Q_WIDGETS_EXPORT bool qt_tryModalHelper(QWidget *widget, QWidget **rettop) | - |
2214 | { | - |
2215 | return QApplicationPrivate::tryModalHelper(widget, rettop); never executed: return QApplicationPrivate::tryModalHelper(widget, rettop); | 0 |
2216 | } | - |
2217 | | - |
2218 | /*! \internal | - |
2219 | Returns true if \a widget is blocked by a modal window. | - |
2220 | */ | - |
2221 | bool QApplicationPrivate::isBlockedByModal(QWidget *widget) | - |
2222 | { | - |
2223 | widget = widget->window(); executed (the execution status of this line is deduced): widget = widget->window(); | - |
2224 | QWindow *window = widget->windowHandle(); executed (the execution status of this line is deduced): QWindow *window = widget->windowHandle(); | - |
2225 | return window && self->isWindowBlocked(window); executed: return window && self->isWindowBlocked(window); Execution Count:153 | 153 |
2226 | } | - |
2227 | | - |
2228 | bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWindow) const | - |
2229 | { | - |
2230 | QWindow *unused = 0; executed (the execution status of this line is deduced): QWindow *unused = 0; | - |
2231 | if (!window) { partially evaluated: !window no Evaluation Count:0 | yes Evaluation Count:633 |
| 0-633 |
2232 | qWarning().nospace() << "window == 0 passed."; never executed (the execution status of this line is deduced): QMessageLogger("kernel/qapplication.cpp", 2232, __PRETTY_FUNCTION__).warning().nospace() << "window == 0 passed."; | - |
2233 | return false; never executed: return false; | 0 |
2234 | } | - |
2235 | if (!blockingWindow) partially evaluated: !blockingWindow yes Evaluation Count:633 | no Evaluation Count:0 |
| 0-633 |
2236 | blockingWindow = &unused; executed: blockingWindow = &unused; Execution Count:633 | 633 |
2237 | | - |
2238 | if (modalWindowList.isEmpty()) { evaluated: modalWindowList.isEmpty() yes Evaluation Count:34 | yes Evaluation Count:599 |
| 34-599 |
2239 | *blockingWindow = 0; executed (the execution status of this line is deduced): *blockingWindow = 0; | - |
2240 | return false; executed: return false; Execution Count:34 | 34 |
2241 | } | - |
2242 | QWidget *popupWidget = QApplication::activePopupWidget(); executed (the execution status of this line is deduced): QWidget *popupWidget = QApplication::activePopupWidget(); | - |
2243 | QWindow *popupWindow = popupWidget ? popupWidget->windowHandle() : 0; partially evaluated: popupWidget no Evaluation Count:0 | yes Evaluation Count:599 |
| 0-599 |
2244 | if (popupWindow == window) { partially evaluated: popupWindow == window no Evaluation Count:0 | yes Evaluation Count:599 |
| 0-599 |
2245 | *blockingWindow = 0; never executed (the execution status of this line is deduced): *blockingWindow = 0; | - |
2246 | return false; never executed: return false; | 0 |
2247 | } | - |
2248 | | - |
2249 | for (int i = 0; i < modalWindowList.count(); ++i) { evaluated: i < modalWindowList.count() yes Evaluation Count:599 | yes Evaluation Count:4 |
| 4-599 |
2250 | QWindow *modalWindow = modalWindowList.at(i); executed (the execution status of this line is deduced): QWindow *modalWindow = modalWindowList.at(i); | - |
2251 | | - |
2252 | { | - |
2253 | // check if the modal window is our window or a (transient) parent of our window | - |
2254 | QWindow *w = window; executed (the execution status of this line is deduced): QWindow *w = window; | - |
2255 | while (w) { evaluated: w yes Evaluation Count:599 | yes Evaluation Count:270 |
| 270-599 |
2256 | if (w == modalWindow) { evaluated: w == modalWindow yes Evaluation Count:329 | yes Evaluation Count:270 |
| 270-329 |
2257 | *blockingWindow = 0; executed (the execution status of this line is deduced): *blockingWindow = 0; | - |
2258 | return false; executed: return false; Execution Count:329 | 329 |
2259 | } | - |
2260 | QWindow *p = w->parent(); executed (the execution status of this line is deduced): QWindow *p = w->parent(); | - |
2261 | if (!p) partially evaluated: !p yes Evaluation Count:270 | no Evaluation Count:0 |
| 0-270 |
2262 | p = w->transientParent(); executed: p = w->transientParent(); Execution Count:270 | 270 |
2263 | w = p; executed (the execution status of this line is deduced): w = p; | - |
2264 | } executed: } Execution Count:270 | 270 |
2265 | | - |
2266 | // Embedded in-process windows are not visible in normal parent-child chain, | - |
2267 | // so check the native parent chain, too. | - |
2268 | const QPlatformWindow *platWin = window->handle(); executed (the execution status of this line is deduced): const QPlatformWindow *platWin = window->handle(); | - |
2269 | const QPlatformWindow *modalPlatWin = modalWindow->handle(); executed (the execution status of this line is deduced): const QPlatformWindow *modalPlatWin = modalWindow->handle(); | - |
2270 | if (platWin && modalPlatWin && platWin->isEmbedded(modalPlatWin)) evaluated: platWin yes Evaluation Count:164 | yes Evaluation Count:106 |
partially evaluated: modalPlatWin yes Evaluation Count:164 | no Evaluation Count:0 |
partially evaluated: platWin->isEmbedded(modalPlatWin) no Evaluation Count:0 | yes Evaluation Count:164 |
| 0-164 |
2271 | return false; never executed: return false; | 0 |
2272 | } | - |
2273 | | - |
2274 | Qt::WindowModality windowModality = modalWindow->modality(); executed (the execution status of this line is deduced): Qt::WindowModality windowModality = modalWindow->modality(); | - |
2275 | QWidgetWindow *modalWidgetWindow = qobject_cast<QWidgetWindow *>(modalWindow); executed (the execution status of this line is deduced): QWidgetWindow *modalWidgetWindow = qobject_cast<QWidgetWindow *>(modalWindow); | - |
2276 | if (windowModality == Qt::NonModal) { partially evaluated: windowModality == Qt::NonModal no Evaluation Count:0 | yes Evaluation Count:270 |
| 0-270 |
2277 | // determine the modality type if it hasn't been set on the | - |
2278 | // modalWindow's widget, this normally happens when waiting for a | - |
2279 | // native dialog. use WindowModal if we are the child of a group | - |
2280 | // leader; otherwise use ApplicationModal. | - |
2281 | QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : 0; never evaluated: modalWidgetWindow | 0 |
2282 | while (m && !m->testAttribute(Qt::WA_GroupLeader)) { never evaluated: m never evaluated: !m->testAttribute(Qt::WA_GroupLeader) | 0 |
2283 | m = m->parentWidget(); never executed (the execution status of this line is deduced): m = m->parentWidget(); | - |
2284 | if (m) | 0 |
2285 | m = m->window(); never executed: m = m->window(); | 0 |
2286 | } | 0 |
2287 | windowModality = (m && m->testAttribute(Qt::WA_GroupLeader)) never evaluated: m never evaluated: m->testAttribute(Qt::WA_GroupLeader) | 0 |
2288 | ? Qt::WindowModal never executed (the execution status of this line is deduced): ? Qt::WindowModal | - |
2289 | : Qt::ApplicationModal; never executed (the execution status of this line is deduced): : Qt::ApplicationModal; | - |
2290 | } | 0 |
2291 | | - |
2292 | switch (windowModality) { | - |
2293 | case Qt::ApplicationModal: | - |
2294 | { | - |
2295 | QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(window); executed (the execution status of this line is deduced): QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(window); | - |
2296 | QWidget *groupLeaderForWidget = widgetWindow ? widgetWindow->widget() : 0; partially evaluated: widgetWindow yes Evaluation Count:266 | no Evaluation Count:0 |
| 0-266 |
2297 | while (groupLeaderForWidget && !groupLeaderForWidget->testAttribute(Qt::WA_GroupLeader)) evaluated: groupLeaderForWidget yes Evaluation Count:275 | yes Evaluation Count:266 |
partially evaluated: !groupLeaderForWidget->testAttribute(Qt::WA_GroupLeader) yes Evaluation Count:275 | no Evaluation Count:0 |
| 0-275 |
2298 | groupLeaderForWidget = groupLeaderForWidget->parentWidget(); executed: groupLeaderForWidget = groupLeaderForWidget->parentWidget(); Execution Count:275 | 275 |
2299 | | - |
2300 | if (groupLeaderForWidget) { partially evaluated: groupLeaderForWidget no Evaluation Count:0 | yes Evaluation Count:266 |
| 0-266 |
2301 | // if \a widget has WA_GroupLeader, it can only be blocked by ApplicationModal children | - |
2302 | QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : 0; never evaluated: modalWidgetWindow | 0 |
2303 | while (m && m != groupLeaderForWidget && !m->testAttribute(Qt::WA_GroupLeader)) never evaluated: m never evaluated: m != groupLeaderForWidget never evaluated: !m->testAttribute(Qt::WA_GroupLeader) | 0 |
2304 | m = m->parentWidget(); never executed: m = m->parentWidget(); | 0 |
2305 | if (m == groupLeaderForWidget) { never evaluated: m == groupLeaderForWidget | 0 |
2306 | *blockingWindow = m->windowHandle(); never executed (the execution status of this line is deduced): *blockingWindow = m->windowHandle(); | - |
2307 | return true; never executed: return true; | 0 |
2308 | } | - |
2309 | } else if (modalWindow != window) { never executed: } partially evaluated: modalWindow != window yes Evaluation Count:266 | no Evaluation Count:0 |
| 0-266 |
2310 | *blockingWindow = modalWindow; executed (the execution status of this line is deduced): *blockingWindow = modalWindow; | - |
2311 | return true; executed: return true; Execution Count:266 | 266 |
2312 | } | - |
2313 | break; | 0 |
2314 | } | - |
2315 | case Qt::WindowModal: | - |
2316 | { | - |
2317 | QWindow *w = window; executed (the execution status of this line is deduced): QWindow *w = window; | - |
2318 | do { | - |
2319 | QWindow *m = modalWindow; executed (the execution status of this line is deduced): QWindow *m = modalWindow; | - |
2320 | do { | - |
2321 | if (m == w) { partially evaluated: m == w no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
2322 | *blockingWindow = m; never executed (the execution status of this line is deduced): *blockingWindow = m; | - |
2323 | return true; never executed: return true; | 0 |
2324 | } | - |
2325 | QWindow *p = m->parent(); executed (the execution status of this line is deduced): QWindow *p = m->parent(); | - |
2326 | if (!p) partially evaluated: !p yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
2327 | p = m->transientParent(); executed: p = m->transientParent(); Execution Count:4 | 4 |
2328 | m = p; executed (the execution status of this line is deduced): m = p; | - |
2329 | } while (m); executed: } Execution Count:4 partially evaluated: m no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
2330 | QWindow *p = w->parent(); executed (the execution status of this line is deduced): QWindow *p = w->parent(); | - |
2331 | if (!p) partially evaluated: !p yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
2332 | p = w->transientParent(); executed: p = w->transientParent(); Execution Count:4 | 4 |
2333 | w = p; executed (the execution status of this line is deduced): w = p; | - |
2334 | } while (w); executed: } Execution Count:4 partially evaluated: w no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
2335 | break; executed: break; Execution Count:4 | 4 |
2336 | } | - |
2337 | default: | - |
2338 | Q_ASSERT_X(false, "QApplication", "internal error, a modal window cannot be modeless"); never executed (the execution status of this line is deduced): qt_noop(); | - |
2339 | break; | 0 |
2340 | } | - |
2341 | } executed: } Execution Count:4 | 4 |
2342 | *blockingWindow = 0; executed (the execution status of this line is deduced): *blockingWindow = 0; | - |
2343 | return false; executed: return false; Execution Count:4 | 4 |
2344 | } | - |
2345 | | - |
2346 | /*!\internal | - |
2347 | | - |
2348 | Called from qapplication_\e{platform}.cpp, returns true | - |
2349 | if the widget should accept the event. | - |
2350 | */ | - |
2351 | bool QApplicationPrivate::tryModalHelper(QWidget *widget, QWidget **rettop) | - |
2352 | { | - |
2353 | QWidget *top = QApplication::activeModalWidget(); executed (the execution status of this line is deduced): QWidget *top = QApplication::activeModalWidget(); | - |
2354 | if (rettop) evaluated: rettop yes Evaluation Count:3 | yes Evaluation Count:146 |
| 3-146 |
2355 | *rettop = top; executed: *rettop = top; Execution Count:3 | 3 |
2356 | | - |
2357 | // the active popup widget always gets the input event | - |
2358 | if (QApplication::activePopupWidget()) partially evaluated: QApplication::activePopupWidget() no Evaluation Count:0 | yes Evaluation Count:149 |
| 0-149 |
2359 | return true; never executed: return true; | 0 |
2360 | | - |
2361 | return !isBlockedByModal(widget->window()); executed: return !isBlockedByModal(widget->window()); Execution Count:149 | 149 |
2362 | } | - |
2363 | | - |
2364 | /* | - |
2365 | \internal | - |
2366 | */ | - |
2367 | QWidget *QApplicationPrivate::pickMouseReceiver(QWidget *candidate, const QPoint &windowPos, | - |
2368 | QPoint *pos, QEvent::Type type, | - |
2369 | Qt::MouseButtons buttons, QWidget *buttonDown, | - |
2370 | QWidget *alienWidget) | - |
2371 | { | - |
2372 | Q_ASSERT(candidate); executed (the execution status of this line is deduced): qt_noop(); | - |
2373 | | - |
2374 | QWidget *mouseGrabber = QWidget::mouseGrabber(); executed (the execution status of this line is deduced): QWidget *mouseGrabber = QWidget::mouseGrabber(); | - |
2375 | if (((type == QEvent::MouseMove && buttons) || (type == QEvent::MouseButtonRelease)) evaluated: type == QEvent::MouseMove yes Evaluation Count:407 | yes Evaluation Count:14 |
partially evaluated: buttons no Evaluation Count:0 | yes Evaluation Count:407 |
evaluated: (type == QEvent::MouseButtonRelease) yes Evaluation Count:7 | yes Evaluation Count:414 |
| 0-414 |
2376 | && !buttonDown && !mouseGrabber) { partially evaluated: !buttonDown no Evaluation Count:0 | yes Evaluation Count:7 |
never evaluated: !mouseGrabber | 0-7 |
2377 | return 0; never executed: return 0; | 0 |
2378 | } | - |
2379 | | - |
2380 | if (alienWidget && alienWidget->internalWinId()) partially evaluated: alienWidget yes Evaluation Count:421 | no Evaluation Count:0 |
evaluated: alienWidget->internalWinId() yes Evaluation Count:8 | yes Evaluation Count:413 |
| 0-421 |
2381 | alienWidget = 0; executed: alienWidget = 0; Execution Count:8 | 8 |
2382 | | - |
2383 | QWidget *receiver = candidate; executed (the execution status of this line is deduced): QWidget *receiver = candidate; | - |
2384 | | - |
2385 | if (!mouseGrabber) evaluated: !mouseGrabber yes Evaluation Count:406 | yes Evaluation Count:15 |
| 15-406 |
2386 | mouseGrabber = (buttonDown && !isBlockedByModal(buttonDown)) ? buttonDown : alienWidget; executed: mouseGrabber = (buttonDown && !isBlockedByModal(buttonDown)) ? buttonDown : alienWidget; Execution Count:406 evaluated: buttonDown yes Evaluation Count:4 | yes Evaluation Count:402 |
partially evaluated: !isBlockedByModal(buttonDown) yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-406 |
2387 | | - |
2388 | if (mouseGrabber && mouseGrabber != candidate) { evaluated: mouseGrabber yes Evaluation Count:419 | yes Evaluation Count:2 |
partially evaluated: mouseGrabber != candidate yes Evaluation Count:419 | no Evaluation Count:0 |
| 0-419 |
2389 | receiver = mouseGrabber; executed (the execution status of this line is deduced): receiver = mouseGrabber; | - |
2390 | *pos = receiver->mapFromGlobal(candidate->mapToGlobal(windowPos)); executed (the execution status of this line is deduced): *pos = receiver->mapFromGlobal(candidate->mapToGlobal(windowPos)); | - |
2391 | #ifdef ALIEN_DEBUG | - |
2392 | qDebug() << " ** receiver adjusted to:" << receiver << "pos:" << pos; | - |
2393 | #endif | - |
2394 | } executed: } Execution Count:419 | 419 |
2395 | | - |
2396 | return receiver; executed: return receiver; Execution Count:421 | 421 |
2397 | | - |
2398 | } | - |
2399 | | - |
2400 | /* | - |
2401 | \internal | - |
2402 | */ | - |
2403 | bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event, | - |
2404 | QWidget *alienWidget, QWidget *nativeWidget, | - |
2405 | QWidget **buttonDown, QPointer<QWidget> &lastMouseReceiver, | - |
2406 | bool spontaneous) | - |
2407 | { | - |
2408 | Q_ASSERT(receiver); executed (the execution status of this line is deduced): qt_noop(); | - |
2409 | Q_ASSERT(event); executed (the execution status of this line is deduced): qt_noop(); | - |
2410 | Q_ASSERT(nativeWidget); executed (the execution status of this line is deduced): qt_noop(); | - |
2411 | Q_ASSERT(buttonDown); executed (the execution status of this line is deduced): qt_noop(); | - |
2412 | | - |
2413 | if (alienWidget && !isAlien(alienWidget)) evaluated: alienWidget yes Evaluation Count:678 | yes Evaluation Count:13 |
evaluated: !isAlien(alienWidget) yes Evaluation Count:104 | yes Evaluation Count:574 |
| 13-678 |
2414 | alienWidget = 0; executed: alienWidget = 0; Execution Count:104 | 104 |
2415 | | - |
2416 | QPointer<QWidget> receiverGuard = receiver; executed (the execution status of this line is deduced): QPointer<QWidget> receiverGuard = receiver; | - |
2417 | QPointer<QWidget> nativeGuard = nativeWidget; executed (the execution status of this line is deduced): QPointer<QWidget> nativeGuard = nativeWidget; | - |
2418 | QPointer<QWidget> alienGuard = alienWidget; executed (the execution status of this line is deduced): QPointer<QWidget> alienGuard = alienWidget; | - |
2419 | QPointer<QWidget> activePopupWidget = QApplication::activePopupWidget(); executed (the execution status of this line is deduced): QPointer<QWidget> activePopupWidget = QApplication::activePopupWidget(); | - |
2420 | | - |
2421 | const bool graphicsWidget = nativeWidget->testAttribute(Qt::WA_DontShowOnScreen); executed (the execution status of this line is deduced): const bool graphicsWidget = nativeWidget->testAttribute(Qt::WA_DontShowOnScreen); | - |
2422 | | - |
2423 | bool widgetUnderMouse = QRectF(receiver->rect()).contains(event->localPos()); executed (the execution status of this line is deduced): bool widgetUnderMouse = QRectF(receiver->rect()).contains(event->localPos()); | - |
2424 | | - |
2425 | // Clear the obsolete leaveAfterRelease value, if mouse button has been released but | - |
2426 | // leaveAfterRelease has not been updated. | - |
2427 | // This happens e.g. when modal dialog or popup is shown as a response to button click. | - |
2428 | if (leaveAfterRelease && !*buttonDown && !event->buttons()) evaluated: leaveAfterRelease yes Evaluation Count:3 | yes Evaluation Count:688 |
evaluated: !*buttonDown yes Evaluation Count:1 | yes Evaluation Count:2 |
partially evaluated: !event->buttons() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-688 |
2429 | leaveAfterRelease = 0; executed: leaveAfterRelease = 0; Execution Count:1 | 1 |
2430 | | - |
2431 | if (*buttonDown) { evaluated: *buttonDown yes Evaluation Count:14 | yes Evaluation Count:677 |
| 14-677 |
2432 | if (!graphicsWidget) { partially evaluated: !graphicsWidget yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
2433 | // Register the widget that shall receive a leave event | - |
2434 | // after the last button is released. | - |
2435 | if ((alienWidget || !receiver->internalWinId()) && !leaveAfterRelease && !QWidget::mouseGrabber()) evaluated: alienWidget yes Evaluation Count:10 | yes Evaluation Count:4 |
partially evaluated: !receiver->internalWinId() yes Evaluation Count:4 | no Evaluation Count:0 |
evaluated: !leaveAfterRelease yes Evaluation Count:12 | yes Evaluation Count:2 |
evaluated: !QWidget::mouseGrabber() yes Evaluation Count:2 | yes Evaluation Count:10 |
| 0-12 |
2436 | leaveAfterRelease = *buttonDown; executed: leaveAfterRelease = *buttonDown; Execution Count:2 | 2 |
2437 | if (event->type() == QEvent::MouseButtonRelease && !event->buttons()) evaluated: event->type() == QEvent::MouseButtonRelease yes Evaluation Count:7 | yes Evaluation Count:7 |
partially evaluated: !event->buttons() yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
2438 | *buttonDown = 0; executed: *buttonDown = 0; Execution Count:7 | 7 |
2439 | } executed: } Execution Count:14 | 14 |
2440 | } else if (lastMouseReceiver && widgetUnderMouse) { executed: } Execution Count:14 evaluated: lastMouseReceiver yes Evaluation Count:671 | yes Evaluation Count:6 |
evaluated: widgetUnderMouse yes Evaluation Count:661 | yes Evaluation Count:10 |
| 6-671 |
2441 | // Dispatch enter/leave if we move: | - |
2442 | // 1) from an alien widget to another alien widget or | - |
2443 | // from a native widget to an alien widget (first OR case) | - |
2444 | // 2) from an alien widget to a native widget (second OR case) | - |
2445 | if ((alienWidget && alienWidget != lastMouseReceiver) evaluated: alienWidget yes Evaluation Count:562 | yes Evaluation Count:99 |
evaluated: alienWidget != lastMouseReceiver yes Evaluation Count:119 | yes Evaluation Count:443 |
| 99-562 |
2446 | || (isAlien(lastMouseReceiver) && !alienWidget)) { evaluated: isAlien(lastMouseReceiver) yes Evaluation Count:539 | yes Evaluation Count:3 |
evaluated: !alienWidget yes Evaluation Count:96 | yes Evaluation Count:443 |
| 3-539 |
2447 | if (activePopupWidget) { partially evaluated: activePopupWidget no Evaluation Count:0 | yes Evaluation Count:215 |
| 0-215 |
2448 | if (!QWidget::mouseGrabber()) never evaluated: !QWidget::mouseGrabber() | 0 |
2449 | dispatchEnterLeave(alienWidget ? alienWidget : nativeWidget, lastMouseReceiver, event->screenPos()); never executed: dispatchEnterLeave(alienWidget ? alienWidget : nativeWidget, lastMouseReceiver, event->screenPos()); | 0 |
2450 | } else { | 0 |
2451 | dispatchEnterLeave(receiver, lastMouseReceiver, event->screenPos()); executed (the execution status of this line is deduced): dispatchEnterLeave(receiver, lastMouseReceiver, event->screenPos()); | - |
2452 | } executed: } Execution Count:215 | 215 |
2453 | | - |
2454 | } | - |
2455 | } executed: } Execution Count:661 | 661 |
2456 | | - |
2457 | #ifdef ALIEN_DEBUG | - |
2458 | qDebug() << "QApplicationPrivate::sendMouseEvent: receiver:" << receiver | - |
2459 | << "pos:" << event->pos() << "alien" << alienWidget << "button down" | - |
2460 | << *buttonDown << "last" << lastMouseReceiver << "leave after release" | - |
2461 | << leaveAfterRelease; | - |
2462 | #endif | - |
2463 | | - |
2464 | // We need this quard in case someone opens a modal dialog / popup. If that's the case | - |
2465 | // leaveAfterRelease is set to null, but we shall not update lastMouseReceiver. | - |
2466 | const bool wasLeaveAfterRelease = leaveAfterRelease != 0; executed (the execution status of this line is deduced): const bool wasLeaveAfterRelease = leaveAfterRelease != 0; | - |
2467 | bool result; executed (the execution status of this line is deduced): bool result; | - |
2468 | if (spontaneous) partially evaluated: spontaneous yes Evaluation Count:691 | no Evaluation Count:0 |
| 0-691 |
2469 | result = QApplication::sendSpontaneousEvent(receiver, event); executed: result = QApplication::sendSpontaneousEvent(receiver, event); Execution Count:691 | 691 |
2470 | else | - |
2471 | result = QApplication::sendEvent(receiver, event); never executed: result = QApplication::sendEvent(receiver, event); | 0 |
2472 | | - |
2473 | if (!graphicsWidget && leaveAfterRelease && event->type() == QEvent::MouseButtonRelease partially evaluated: !graphicsWidget yes Evaluation Count:691 | no Evaluation Count:0 |
evaluated: leaveAfterRelease yes Evaluation Count:3 | yes Evaluation Count:688 |
evaluated: event->type() == QEvent::MouseButtonRelease yes Evaluation Count:1 | yes Evaluation Count:2 |
| 0-691 |
2474 | && !event->buttons() && QWidget::mouseGrabber() != leaveAfterRelease) { partially evaluated: !event->buttons() yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: QWidget::mouseGrabber() != leaveAfterRelease yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2475 | // Dispatch enter/leave if: | - |
2476 | // 1) the mouse grabber is an alien widget | - |
2477 | // 2) the button is released on an alien widget | - |
2478 | QWidget *enter = 0; executed (the execution status of this line is deduced): QWidget *enter = 0; | - |
2479 | if (nativeGuard) partially evaluated: nativeGuard yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2480 | enter = alienGuard ? alienWidget : nativeWidget; executed: enter = alienGuard ? alienWidget : nativeWidget; Execution Count:1 partially evaluated: alienGuard yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2481 | else // The receiver is typically deleted on mouse release with drag'n'drop. | - |
2482 | enter = QApplication::widgetAt(event->globalPos()); never executed: enter = QApplication::widgetAt(event->globalPos()); | 0 |
2483 | dispatchEnterLeave(enter, leaveAfterRelease, event->screenPos()); executed (the execution status of this line is deduced): dispatchEnterLeave(enter, leaveAfterRelease, event->screenPos()); | - |
2484 | leaveAfterRelease = 0; executed (the execution status of this line is deduced): leaveAfterRelease = 0; | - |
2485 | lastMouseReceiver = enter; executed (the execution status of this line is deduced): lastMouseReceiver = enter; | - |
2486 | } else if (!wasLeaveAfterRelease) { executed: } Execution Count:1 evaluated: !wasLeaveAfterRelease yes Evaluation Count:687 | yes Evaluation Count:3 |
| 1-687 |
2487 | if (activePopupWidget) { evaluated: activePopupWidget yes Evaluation Count:22 | yes Evaluation Count:665 |
| 22-665 |
2488 | if (!QWidget::mouseGrabber()) partially evaluated: !QWidget::mouseGrabber() yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
2489 | lastMouseReceiver = alienGuard ? alienWidget : (nativeGuard ? nativeWidget : 0); executed: lastMouseReceiver = alienGuard ? alienWidget : (nativeGuard ? nativeWidget : 0); Execution Count:22 evaluated: alienGuard yes Evaluation Count:9 | yes Evaluation Count:13 |
| 9-22 |
2490 | } else { executed: } Execution Count:22 | 22 |
2491 | lastMouseReceiver = receiverGuard ? receiver : QApplication::widgetAt(event->globalPos()); partially evaluated: receiverGuard yes Evaluation Count:665 | no Evaluation Count:0 |
| 0-665 |
2492 | } executed: } Execution Count:665 | 665 |
2493 | } | - |
2494 | | - |
2495 | return result; executed: return result; Execution Count:691 | 691 |
2496 | } | - |
2497 | | - |
2498 | /* | - |
2499 | This function should only be called when the widget changes visibility, i.e. | - |
2500 | when the \a widget is shown, hidden or deleted. This function does nothing | - |
2501 | if the widget is a top-level or native, i.e. not an alien widget. In that | - |
2502 | case enter/leave events are genereated by the underlying windowing system. | - |
2503 | */ | - |
2504 | extern QPointer<QWidget> qt_last_mouse_receiver; | - |
2505 | extern QWidget *qt_button_down; | - |
2506 | void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) | - |
2507 | { | - |
2508 | #ifndef QT_NO_CURSOR | - |
2509 | if (!widget || widget->isWindow()) partially evaluated: !widget no Evaluation Count:0 | yes Evaluation Count:25443 |
evaluated: widget->isWindow() yes Evaluation Count:5053 | yes Evaluation Count:20390 |
| 0-25443 |
2510 | return; executed: return; Execution Count:5053 | 5053 |
2511 | const bool widgetInShow = widget->isVisible() && !widget->data->in_destructor; evaluated: widget->isVisible() yes Evaluation Count:8634 | yes Evaluation Count:11756 |
evaluated: !widget->data->in_destructor yes Evaluation Count:8015 | yes Evaluation Count:619 |
| 619-11756 |
2512 | if (!widgetInShow && widget != qt_last_mouse_receiver) evaluated: !widgetInShow yes Evaluation Count:12375 | yes Evaluation Count:8015 |
evaluated: widget != qt_last_mouse_receiver yes Evaluation Count:11439 | yes Evaluation Count:936 |
| 936-12375 |
2513 | return; // Widget was not under the cursor when it was hidden/deleted. executed: return; Execution Count:11439 | 11439 |
2514 | | - |
2515 | if (widgetInShow && widget->parentWidget()->data->in_show) evaluated: widgetInShow yes Evaluation Count:8015 | yes Evaluation Count:936 |
evaluated: widget->parentWidget()->data->in_show yes Evaluation Count:6628 | yes Evaluation Count:1387 |
| 936-8015 |
2516 | return; // Ingore recursive show. executed: return; Execution Count:6628 | 6628 |
2517 | | - |
2518 | QWidget *mouseGrabber = QWidget::mouseGrabber(); executed (the execution status of this line is deduced): QWidget *mouseGrabber = QWidget::mouseGrabber(); | - |
2519 | if (mouseGrabber && mouseGrabber != widget) partially evaluated: mouseGrabber no Evaluation Count:0 | yes Evaluation Count:2323 |
never evaluated: mouseGrabber != widget | 0-2323 |
2520 | return; // Someone else has the grab; enter/leave should not occur. | 0 |
2521 | | - |
2522 | QWidget *tlw = widget->window(); executed (the execution status of this line is deduced): QWidget *tlw = widget->window(); | - |
2523 | if (tlw->data->in_destructor || tlw->data->is_closing) evaluated: tlw->data->in_destructor yes Evaluation Count:745 | yes Evaluation Count:1578 |
evaluated: tlw->data->is_closing yes Evaluation Count:11 | yes Evaluation Count:1567 |
| 11-1578 |
2524 | return; // Closing down the business. executed: return; Execution Count:756 | 756 |
2525 | | - |
2526 | if (widgetInShow && (!qt_last_mouse_receiver || qt_last_mouse_receiver->window() != tlw)) evaluated: widgetInShow yes Evaluation Count:1385 | yes Evaluation Count:182 |
evaluated: !qt_last_mouse_receiver yes Evaluation Count:753 | yes Evaluation Count:632 |
evaluated: qt_last_mouse_receiver->window() != tlw yes Evaluation Count:336 | yes Evaluation Count:296 |
| 182-1385 |
2527 | return; // Mouse cursor not inside the widget's top-level. executed: return; Execution Count:1089 | 1089 |
2528 | | - |
2529 | const QPoint globalPos(QCursor::pos()); executed (the execution status of this line is deduced): const QPoint globalPos(QCursor::pos()); | - |
2530 | QPoint windowPos = tlw->mapFromGlobal(globalPos); executed (the execution status of this line is deduced): QPoint windowPos = tlw->mapFromGlobal(globalPos); | - |
2531 | | - |
2532 | // Find the current widget under the mouse. If this function was called from | - |
2533 | // the widget's destructor, we have to make sure childAt() doesn't take into | - |
2534 | // account widgets that are about to be destructed. | - |
2535 | QWidget *widgetUnderCursor = tlw->d_func()->childAt_helper(windowPos, widget->data->in_destructor); executed (the execution status of this line is deduced): QWidget *widgetUnderCursor = tlw->d_func()->childAt_helper(windowPos, widget->data->in_destructor); | - |
2536 | if (!widgetUnderCursor) evaluated: !widgetUnderCursor yes Evaluation Count:127 | yes Evaluation Count:351 |
| 127-351 |
2537 | widgetUnderCursor = tlw; executed: widgetUnderCursor = tlw; Execution Count:127 | 127 |
2538 | QPoint pos = widgetUnderCursor->mapFrom(tlw, windowPos); executed (the execution status of this line is deduced): QPoint pos = widgetUnderCursor->mapFrom(tlw, windowPos); | - |
2539 | | - |
2540 | if (widgetInShow && widgetUnderCursor != widget && !widget->isAncestorOf(widgetUnderCursor)) evaluated: widgetInShow yes Evaluation Count:296 | yes Evaluation Count:182 |
evaluated: widgetUnderCursor != widget yes Evaluation Count:266 | yes Evaluation Count:30 |
evaluated: !widget->isAncestorOf(widgetUnderCursor) yes Evaluation Count:223 | yes Evaluation Count:43 |
| 30-296 |
2541 | return; // Mouse cursor not inside the widget or any of its children. executed: return; Execution Count:223 | 223 |
2542 | | - |
2543 | if (widget->data->in_destructor && qt_button_down == widget) evaluated: widget->data->in_destructor yes Evaluation Count:65 | yes Evaluation Count:190 |
partially evaluated: qt_button_down == widget no Evaluation Count:0 | yes Evaluation Count:65 |
| 0-190 |
2544 | qt_button_down = 0; never executed: qt_button_down = 0; | 0 |
2545 | | - |
2546 | // Send enter/leave events followed by a mouse move on the entered widget. | - |
2547 | QMouseEvent e(QEvent::MouseMove, pos, windowPos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); executed (the execution status of this line is deduced): QMouseEvent e(QEvent::MouseMove, pos, windowPos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); | - |
2548 | sendMouseEvent(widgetUnderCursor, &e, widgetUnderCursor, tlw, &qt_button_down, qt_last_mouse_receiver); executed (the execution status of this line is deduced): sendMouseEvent(widgetUnderCursor, &e, widgetUnderCursor, tlw, &qt_button_down, qt_last_mouse_receiver); | - |
2549 | #endif // QT_NO_CURSOR | - |
2550 | } executed: } Execution Count:255 | 255 |
2551 | | - |
2552 | /*! | - |
2553 | Returns the desktop widget (also called the root window). | - |
2554 | | - |
2555 | The desktop may be composed of multiple screens, so it would be incorrect, | - |
2556 | for example, to attempt to \e center some widget in the desktop's geometry. | - |
2557 | QDesktopWidget has various functions for obtaining useful geometries upon | - |
2558 | the desktop, such as QDesktopWidget::screenGeometry() and | - |
2559 | QDesktopWidget::availableGeometry(). | - |
2560 | | - |
2561 | On X11, it is also possible to draw on the desktop. | - |
2562 | */ | - |
2563 | QDesktopWidget *QApplication::desktop() | - |
2564 | { | - |
2565 | if (!qt_desktopWidget || // not created yet evaluated: !qt_desktopWidget yes Evaluation Count:106 | yes Evaluation Count:4575 |
| 106-4575 |
2566 | !(qt_desktopWidget->windowType() == Qt::Desktop)) { // reparented away partially evaluated: !(qt_desktopWidget->windowType() == Qt::Desktop) no Evaluation Count:0 | yes Evaluation Count:4575 |
| 0-4575 |
2567 | qt_desktopWidget = new QDesktopWidget(); executed (the execution status of this line is deduced): qt_desktopWidget = new QDesktopWidget(); | - |
2568 | } executed: } Execution Count:106 | 106 |
2569 | return qt_desktopWidget; executed: return qt_desktopWidget; Execution Count:4681 | 4681 |
2570 | } | - |
2571 | | - |
2572 | /* | - |
2573 | Sets the time after which a drag should start to \a ms ms. | - |
2574 | | - |
2575 | \sa startDragTime() | - |
2576 | */ | - |
2577 | | - |
2578 | void QApplication::setStartDragTime(int ms) | - |
2579 | { | - |
2580 | Q_UNUSED(ms) never executed (the execution status of this line is deduced): (void)ms; | - |
2581 | } | 0 |
2582 | | - |
2583 | /*! | - |
2584 | \property QApplication::startDragTime | - |
2585 | \brief the time in milliseconds that a mouse button must be held down | - |
2586 | before a drag and drop operation will begin | - |
2587 | | - |
2588 | If you support drag and drop in your application, and want to start a drag | - |
2589 | and drop operation after the user has held down a mouse button for a | - |
2590 | certain amount of time, you should use this property's value as the delay. | - |
2591 | | - |
2592 | Qt also uses this delay internally, e.g. in QTextEdit and QLineEdit, for | - |
2593 | starting a drag. | - |
2594 | | - |
2595 | The default value is 500 ms. | - |
2596 | | - |
2597 | \sa startDragDistance(), {Drag and Drop} | - |
2598 | */ | - |
2599 | | - |
2600 | int QApplication::startDragTime() | - |
2601 | { | - |
2602 | return qApp->styleHints()->startDragTime(); never executed: return (static_cast<QApplication *>(QCoreApplication::instance()))->styleHints()->startDragTime(); | 0 |
2603 | } | - |
2604 | | - |
2605 | /* | - |
2606 | Sets the distance after which a drag should start to \a l pixels. | - |
2607 | | - |
2608 | \sa startDragDistance() | - |
2609 | */ | - |
2610 | | - |
2611 | void QApplication::setStartDragDistance(int l) | - |
2612 | { | - |
2613 | Q_UNUSED(l); never executed (the execution status of this line is deduced): (void)l;; | - |
2614 | } | 0 |
2615 | | - |
2616 | /*! | - |
2617 | \property QApplication::startDragDistance | - |
2618 | | - |
2619 | If you support drag and drop in your application, and want to start a drag | - |
2620 | and drop operation after the user has moved the cursor a certain distance | - |
2621 | with a button held down, you should use this property's value as the | - |
2622 | minimum distance required. | - |
2623 | | - |
2624 | For example, if the mouse position of the click is stored in \c startPos | - |
2625 | and the current position (e.g. in the mouse move event) is \c currentPos, | - |
2626 | you can find out if a drag should be started with code like this: | - |
2627 | | - |
2628 | \snippet code/src_gui_kernel_qapplication.cpp 7 | - |
2629 | | - |
2630 | Qt uses this value internally, e.g. in QFileDialog. | - |
2631 | | - |
2632 | The default value is 4 pixels. | - |
2633 | | - |
2634 | \sa startDragTime(), QPoint::manhattanLength(), {Drag and Drop} | - |
2635 | */ | - |
2636 | | - |
2637 | int QApplication::startDragDistance() | - |
2638 | { | - |
2639 | return qApp->styleHints()->startDragDistance(); executed: return (static_cast<QApplication *>(QCoreApplication::instance()))->styleHints()->startDragDistance(); Execution Count:9 | 9 |
2640 | } | - |
2641 | | - |
2642 | /*! | - |
2643 | Enters the main event loop and waits until exit() is called, then returns | - |
2644 | the value that was set to exit() (which is 0 if exit() is called via | - |
2645 | quit()). | - |
2646 | | - |
2647 | It is necessary to call this function to start event handling. The main | - |
2648 | event loop receives events from the window system and dispatches these to | - |
2649 | the application widgets. | - |
2650 | | - |
2651 | Generally, no user interaction can take place before calling exec(). As a | - |
2652 | special case, modal widgets like QMessageBox can be used before calling | - |
2653 | exec(), because modal widgets call exec() to start a local event loop. | - |
2654 | | - |
2655 | To make your application perform idle processing, i.e., executing a special | - |
2656 | function whenever there are no pending events, use a QTimer with 0 timeout. | - |
2657 | More advanced idle processing schemes can be achieved using processEvents(). | - |
2658 | | - |
2659 | We recommend that you connect clean-up code to the | - |
2660 | \l{QCoreApplication::}{aboutToQuit()} signal, instead of putting it in your | - |
2661 | application's \c{main()} function. This is because, on some platforms the | - |
2662 | QApplication::exec() call may not return. For example, on the Windows | - |
2663 | platform, when the user logs off, the system terminates the process after Qt | - |
2664 | closes all top-level windows. Hence, there is \e{no guarantee} that the | - |
2665 | application will have time to exit its event loop and execute code at the | - |
2666 | end of the \c{main()} function, after the QApplication::exec() call. | - |
2667 | | - |
2668 | \sa quitOnLastWindowClosed, quit(), exit(), processEvents(), | - |
2669 | QCoreApplication::exec() | - |
2670 | */ | - |
2671 | int QApplication::exec() | - |
2672 | { | - |
2673 | return QGuiApplication::exec(); executed: return QGuiApplication::exec(); Execution Count:39 | 39 |
2674 | } | - |
2675 | | - |
2676 | bool QApplicationPrivate::shouldQuit() | - |
2677 | { | - |
2678 | /* if there is no non-withdrawn primary window left (except | - |
2679 | the ones without QuitOnClose), we emit the lastWindowClosed | - |
2680 | signal */ | - |
2681 | QWidgetList list = QApplication::topLevelWidgets(); executed (the execution status of this line is deduced): QWidgetList list = QApplication::topLevelWidgets(); | - |
2682 | for (int i = 0; i < list.size(); ++i) { evaluated: i < list.size() yes Evaluation Count:24 | yes Evaluation Count:15 |
| 15-24 |
2683 | QWidget *w = list.at(i); executed (the execution status of this line is deduced): QWidget *w = list.at(i); | - |
2684 | if (w->isVisible() && !w->parentWidget() && w->testAttribute(Qt::WA_QuitOnClose)) evaluated: w->isVisible() yes Evaluation Count:2 | yes Evaluation Count:22 |
evaluated: !w->parentWidget() yes Evaluation Count:1 | yes Evaluation Count:1 |
partially evaluated: w->testAttribute(Qt::WA_QuitOnClose) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-22 |
2685 | return false; never executed: return false; | 0 |
2686 | } executed: } Execution Count:24 | 24 |
2687 | return QGuiApplicationPrivate::shouldQuit(); executed: return QGuiApplicationPrivate::shouldQuit(); Execution Count:15 | 15 |
2688 | } | - |
2689 | | - |
2690 | static inline void closeAllPopups() | - |
2691 | { | - |
2692 | // Close all popups: In case some popup refuses to close, | - |
2693 | // we give up after 1024 attempts (to avoid an infinite loop). | - |
2694 | int maxiter = 1024; executed (the execution status of this line is deduced): int maxiter = 1024; | - |
2695 | QWidget *popup; executed (the execution status of this line is deduced): QWidget *popup; | - |
2696 | while ((popup = QApplication::activePopupWidget()) && maxiter--) partially evaluated: (popup = QApplication::activePopupWidget()) no Evaluation Count:0 | yes Evaluation Count:44 |
never evaluated: maxiter-- | 0-44 |
2697 | popup->close(); never executed: popup->close(); | 0 |
2698 | } executed: } Execution Count:44 | 44 |
2699 | | - |
2700 | /*! \reimp | - |
2701 | */ | - |
2702 | bool QApplication::notify(QObject *receiver, QEvent *e) | - |
2703 | { | - |
2704 | Q_D(QApplication); executed (the execution status of this line is deduced): QApplicationPrivate * const d = d_func(); | - |
2705 | // no events are delivered after ~QCoreApplication() has started | - |
2706 | if (QApplicationPrivate::is_app_closing) evaluated: QApplicationPrivate::is_app_closing yes Evaluation Count:620 | yes Evaluation Count:662029 |
| 620-662029 |
2707 | return true; executed: return true; Execution Count:620 | 620 |
2708 | | - |
2709 | if (receiver == 0) { // serious error partially evaluated: receiver == 0 no Evaluation Count:0 | yes Evaluation Count:662029 |
| 0-662029 |
2710 | qWarning("QApplication::notify: Unexpected null receiver"); never executed (the execution status of this line is deduced): QMessageLogger("kernel/qapplication.cpp", 2710, __PRETTY_FUNCTION__).warning("QApplication::notify: Unexpected null receiver"); | - |
2711 | return true; never executed: return true; | 0 |
2712 | } | - |
2713 | | - |
2714 | #ifndef QT_NO_DEBUG | - |
2715 | d->checkReceiverThread(receiver); | - |
2716 | #endif | - |
2717 | | - |
2718 | if (receiver->isWindowType()) evaluated: receiver->isWindowType() yes Evaluation Count:22801 | yes Evaluation Count:639230 |
| 22801-639230 |
2719 | QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(static_cast<QWindow *>(receiver), e); executed: QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(static_cast<QWindow *>(receiver), e); Execution Count:22801 | 22801 |
2720 | | - |
2721 | if(e->spontaneous()) { evaluated: e->spontaneous() yes Evaluation Count:63529 | yes Evaluation Count:598502 |
| 63529-598502 |
2722 | // Capture the current mouse and keyboard states. Doing so here is | - |
2723 | // required in order to support Qt Test synthesized events. Real mouse | - |
2724 | // and keyboard state updates from the platform plugin are managed by | - |
2725 | // QGuiApplicationPrivate::process(Mouse|Wheel|Key|Touch|Tablet)Event(); | - |
2726 | switch (e->type()) { | - |
2727 | case QEvent::MouseButtonPress: | - |
2728 | { | - |
2729 | QMouseEvent *me = static_cast<QMouseEvent*>(e); executed (the execution status of this line is deduced): QMouseEvent *me = static_cast<QMouseEvent*>(e); | - |
2730 | QApplicationPrivate::modifier_buttons = me->modifiers(); executed (the execution status of this line is deduced): QApplicationPrivate::modifier_buttons = me->modifiers(); | - |
2731 | QApplicationPrivate::mouse_buttons |= me->button(); executed (the execution status of this line is deduced): QApplicationPrivate::mouse_buttons |= me->button(); | - |
2732 | break; executed: break; Execution Count:5296 | 5296 |
2733 | } | - |
2734 | case QEvent::MouseButtonRelease: | - |
2735 | { | - |
2736 | QMouseEvent *me = static_cast<QMouseEvent*>(e); executed (the execution status of this line is deduced): QMouseEvent *me = static_cast<QMouseEvent*>(e); | - |
2737 | QApplicationPrivate::modifier_buttons = me->modifiers(); executed (the execution status of this line is deduced): QApplicationPrivate::modifier_buttons = me->modifiers(); | - |
2738 | QApplicationPrivate::mouse_buttons &= ~me->button(); executed (the execution status of this line is deduced): QApplicationPrivate::mouse_buttons &= ~me->button(); | - |
2739 | break; executed: break; Execution Count:5256 | 5256 |
2740 | } | - |
2741 | case QEvent::KeyPress: | - |
2742 | case QEvent::KeyRelease: | - |
2743 | case QEvent::MouseMove: | - |
2744 | #ifndef QT_NO_WHEELEVENT | - |
2745 | case QEvent::Wheel: | - |
2746 | #endif | - |
2747 | case QEvent::TouchBegin: | - |
2748 | case QEvent::TouchUpdate: | - |
2749 | case QEvent::TouchEnd: | - |
2750 | #ifndef QT_NO_TABLETEVENT | - |
2751 | case QEvent::TabletMove: | - |
2752 | case QEvent::TabletPress: | - |
2753 | case QEvent::TabletRelease: | - |
2754 | #endif | - |
2755 | { | - |
2756 | QInputEvent *ie = static_cast<QInputEvent*>(e); executed (the execution status of this line is deduced): QInputEvent *ie = static_cast<QInputEvent*>(e); | - |
2757 | QApplicationPrivate::modifier_buttons = ie->modifiers(); executed (the execution status of this line is deduced): QApplicationPrivate::modifier_buttons = ie->modifiers(); | - |
2758 | break; executed: break; Execution Count:11817 | 11817 |
2759 | } | - |
2760 | default: | - |
2761 | break; executed: break; Execution Count:41160 | 41160 |
2762 | } | - |
2763 | } executed: } Execution Count:63529 | 63529 |
2764 | | - |
2765 | #ifndef QT_NO_GESTURES | - |
2766 | // walk through parents and check for gestures | - |
2767 | if (d->gestureManager) { evaluated: d->gestureManager yes Evaluation Count:532491 | yes Evaluation Count:129541 |
| 129541-532491 |
2768 | switch (e->type()) { | - |
2769 | case QEvent::Paint: | - |
2770 | case QEvent::MetaCall: | - |
2771 | case QEvent::DeferredDelete: | - |
2772 | case QEvent::DragEnter: case QEvent::DragMove: case QEvent::DragLeave: | - |
2773 | case QEvent::Drop: case QEvent::DragResponse: | - |
2774 | case QEvent::ChildAdded: case QEvent::ChildPolished: | - |
2775 | case QEvent::ChildRemoved: | - |
2776 | case QEvent::UpdateRequest: | - |
2777 | case QEvent::UpdateLater: | - |
2778 | case QEvent::LocaleChange: | - |
2779 | case QEvent::Style: | - |
2780 | case QEvent::IconDrag: | - |
2781 | case QEvent::StyleChange: | - |
2782 | case QEvent::GraphicsSceneDragEnter: | - |
2783 | case QEvent::GraphicsSceneDragMove: | - |
2784 | case QEvent::GraphicsSceneDragLeave: | - |
2785 | case QEvent::GraphicsSceneDrop: | - |
2786 | case QEvent::DynamicPropertyChange: | - |
2787 | case QEvent::NetworkReplyUpdated: | - |
2788 | break; executed: break; Execution Count:158382 | 158382 |
2789 | default: | - |
2790 | if (receiver->isWidgetType()) { evaluated: receiver->isWidgetType() yes Evaluation Count:335546 | yes Evaluation Count:38563 |
| 38563-335546 |
2791 | if (d->gestureManager->filterEvent(static_cast<QWidget *>(receiver), e)) evaluated: d->gestureManager->filterEvent(static_cast<QWidget *>(receiver), e) yes Evaluation Count:12 | yes Evaluation Count:335534 |
| 12-335534 |
2792 | return true; executed: return true; Execution Count:12 | 12 |
2793 | } else { executed: } Execution Count:335534 | 335534 |
2794 | // a special case for events that go to QGesture objects. | - |
2795 | // We pass the object to the gesture manager and it'll figure | - |
2796 | // out if it's QGesture or not. | - |
2797 | if (d->gestureManager->filterEvent(receiver, e)) partially evaluated: d->gestureManager->filterEvent(receiver, e) no Evaluation Count:0 | yes Evaluation Count:38563 |
| 0-38563 |
2798 | return true; never executed: return true; | 0 |
2799 | } executed: } Execution Count:38563 | 38563 |
2800 | } | - |
2801 | } executed: } Execution Count:532479 | 532479 |
2802 | #endif // QT_NO_GESTURES | - |
2803 | | - |
2804 | switch (e->type()) { | - |
2805 | case QEvent::ApplicationDeactivate: | - |
2806 | // Close all popups (triggers when switching applications | - |
2807 | // by pressing ALT-TAB on Windows, which is not receive as key event. | - |
2808 | closeAllPopups(); executed (the execution status of this line is deduced): closeAllPopups(); | - |
2809 | break; executed: break; Execution Count:44 | 44 |
2810 | case QEvent::Wheel: // User input and window activation makes tooltips sleep | - |
2811 | case QEvent::ActivationChange: | - |
2812 | case QEvent::KeyPress: | - |
2813 | case QEvent::KeyRelease: | - |
2814 | case QEvent::FocusOut: | - |
2815 | case QEvent::FocusIn: | - |
2816 | case QEvent::MouseButtonPress: | - |
2817 | case QEvent::MouseButtonRelease: | - |
2818 | case QEvent::MouseButtonDblClick: | - |
2819 | d->toolTipFallAsleep.stop(); executed (the execution status of this line is deduced): d->toolTipFallAsleep.stop(); | - |
2820 | // fall-through | - |
2821 | case QEvent::Leave: code before this statement executed: case QEvent::Leave: Execution Count:35569 | 35569 |
2822 | d->toolTipWakeUp.stop(); executed (the execution status of this line is deduced): d->toolTipWakeUp.stop(); | - |
2823 | default: | - |
2824 | break; executed: break; Execution Count:661974 | 661974 |
2825 | } | - |
2826 | | - |
2827 | bool res = false; executed (the execution status of this line is deduced): bool res = false; | - |
2828 | if (!receiver->isWidgetType()) { evaluated: !receiver->isWidgetType() yes Evaluation Count:74987 | yes Evaluation Count:587029 |
| 74987-587029 |
2829 | res = d->notify_helper(receiver, e); executed (the execution status of this line is deduced): res = d->notify_helper(receiver, e); | - |
2830 | } else switch (e->type()) { executed: } Execution Count:74982 | 74982 |
2831 | case QEvent::ShortcutOverride: | - |
2832 | case QEvent::KeyPress: | - |
2833 | case QEvent::KeyRelease: | - |
2834 | { | - |
2835 | bool isWidget = receiver->isWidgetType(); executed (the execution status of this line is deduced): bool isWidget = receiver->isWidgetType(); | - |
2836 | bool isGraphicsWidget = false; executed (the execution status of this line is deduced): bool isGraphicsWidget = false; | - |
2837 | #ifndef QT_NO_GRAPHICSVIEW | - |
2838 | isGraphicsWidget = !isWidget && qobject_cast<QGraphicsWidget *>(receiver); partially evaluated: !isWidget no Evaluation Count:0 | yes Evaluation Count:16196 |
never evaluated: qobject_cast<QGraphicsWidget *>(receiver) | 0-16196 |
2839 | #endif | - |
2840 | if (!isWidget && !isGraphicsWidget) { partially evaluated: !isWidget no Evaluation Count:0 | yes Evaluation Count:16196 |
never evaluated: !isGraphicsWidget | 0-16196 |
2841 | res = d->notify_helper(receiver, e); never executed (the execution status of this line is deduced): res = d->notify_helper(receiver, e); | - |
2842 | break; | 0 |
2843 | } | - |
2844 | | - |
2845 | QKeyEvent* key = static_cast<QKeyEvent*>(e); executed (the execution status of this line is deduced): QKeyEvent* key = static_cast<QKeyEvent*>(e); | - |
2846 | if (key->type()==QEvent::KeyPress) { evaluated: key->type()==QEvent::KeyPress yes Evaluation Count:5520 | yes Evaluation Count:10676 |
| 5520-10676 |
2847 | #ifndef QT_NO_SHORTCUT | - |
2848 | // Try looking for a Shortcut before sending key events | - |
2849 | if ((res = qApp->d_func()->shortcutMap.tryShortcutEvent(receiver, key))) evaluated: (res = (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.tryShortcutEvent(receiver, key)) yes Evaluation Count:118 | yes Evaluation Count:5402 |
| 118-5402 |
2850 | return res; executed: return res; Execution Count:118 | 118 |
2851 | #endif | - |
2852 | qt_in_tab_key_event = (key->key() == Qt::Key_Backtab evaluated: key->key() == Qt::Key_Backtab yes Evaluation Count:20 | yes Evaluation Count:5382 |
| 20-5382 |
2853 | || key->key() == Qt::Key_Tab evaluated: key->key() == Qt::Key_Tab yes Evaluation Count:143 | yes Evaluation Count:5239 |
| 143-5239 |
2854 | || key->key() == Qt::Key_Left evaluated: key->key() == Qt::Key_Left yes Evaluation Count:448 | yes Evaluation Count:4791 |
| 448-4791 |
2855 | || key->key() == Qt::Key_Up evaluated: key->key() == Qt::Key_Up yes Evaluation Count:1087 | yes Evaluation Count:3704 |
| 1087-3704 |
2856 | || key->key() == Qt::Key_Right evaluated: key->key() == Qt::Key_Right yes Evaluation Count:398 | yes Evaluation Count:3306 |
| 398-3306 |
2857 | || key->key() == Qt::Key_Down); evaluated: key->key() == Qt::Key_Down yes Evaluation Count:527 | yes Evaluation Count:2779 |
| 527-2779 |
2858 | } executed: } Execution Count:5402 | 5402 |
2859 | bool def = key->isAccepted(); executed (the execution status of this line is deduced): bool def = key->isAccepted(); | - |
2860 | QPointer<QObject> pr = receiver; executed (the execution status of this line is deduced): QPointer<QObject> pr = receiver; | - |
2861 | while (receiver) { partially evaluated: receiver yes Evaluation Count:18763 | no Evaluation Count:0 |
| 0-18763 |
2862 | if (def) evaluated: def yes Evaluation Count:12424 | yes Evaluation Count:6339 |
| 6339-12424 |
2863 | key->accept(); executed: key->accept(); Execution Count:12424 | 12424 |
2864 | else | - |
2865 | key->ignore(); executed: key->ignore(); Execution Count:6339 | 6339 |
2866 | res = d->notify_helper(receiver, e); executed (the execution status of this line is deduced): res = d->notify_helper(receiver, e); | - |
2867 | QWidget *w = isWidget ? static_cast<QWidget *>(receiver) : 0; partially evaluated: isWidget yes Evaluation Count:18763 | no Evaluation Count:0 |
| 0-18763 |
2868 | #ifndef QT_NO_GRAPHICSVIEW | - |
2869 | QGraphicsWidget *gw = isGraphicsWidget ? static_cast<QGraphicsWidget *>(receiver) : 0; partially evaluated: isGraphicsWidget no Evaluation Count:0 | yes Evaluation Count:18763 |
| 0-18763 |
2870 | #endif | - |
2871 | | - |
2872 | if ((res && key->isAccepted()) evaluated: res yes Evaluation Count:18760 | yes Evaluation Count:3 |
evaluated: key->isAccepted() yes Evaluation Count:7074 | yes Evaluation Count:11686 |
| 3-18760 |
2873 | /* | - |
2874 | QLineEdit will emit a signal on Key_Return, but | - |
2875 | ignore the event, and sometimes the connected | - |
2876 | slot deletes the QLineEdit (common in itemview | - |
2877 | delegates), so we have to check if the widget | - |
2878 | was destroyed even if the event was ignored (to | - |
2879 | prevent a crash) | - |
2880 | | - |
2881 | note that we don't have to reset pw while | - |
2882 | propagating (because the original receiver will | - |
2883 | be destroyed if one of its ancestors is) | - |
2884 | */ | - |
2885 | || !pr partially evaluated: !pr no Evaluation Count:0 | yes Evaluation Count:11689 |
| 0-11689 |
2886 | || (isWidget && (w->isWindow() || !w->parentWidget())) partially evaluated: isWidget yes Evaluation Count:11689 | no Evaluation Count:0 |
evaluated: w->isWindow() yes Evaluation Count:9004 | yes Evaluation Count:2685 |
partially evaluated: !w->parentWidget() no Evaluation Count:0 | yes Evaluation Count:2685 |
| 0-11689 |
2887 | #ifndef QT_NO_GRAPHICSVIEW executed (the execution status of this line is deduced):
| - |
2888 | || (isGraphicsWidget && (gw->isWindow() || !gw->parentWidget())) partially evaluated: isGraphicsWidget no Evaluation Count:0 | yes Evaluation Count:2685 |
never evaluated: gw->isWindow() never evaluated: !gw->parentWidget() | 0-2685 |
2889 | #endif | - |
2890 | ) { | - |
2891 | break; executed: break; Execution Count:16078 | 16078 |
2892 | } | - |
2893 | | - |
2894 | #ifndef QT_NO_GRAPHICSVIEW | - |
2895 | receiver = w ? (QObject *)w->parentWidget() : (QObject *)gw->parentWidget(); partially evaluated: w yes Evaluation Count:2685 | no Evaluation Count:0 |
| 0-2685 |
2896 | #else | - |
2897 | receiver = w->parentWidget(); | - |
2898 | #endif | - |
2899 | } executed: } Execution Count:2685 | 2685 |
2900 | qt_in_tab_key_event = false; executed (the execution status of this line is deduced): qt_in_tab_key_event = false; | - |
2901 | } | - |
2902 | break; executed: break; Execution Count:16078 | 16078 |
2903 | case QEvent::MouseButtonPress: | - |
2904 | case QEvent::MouseButtonRelease: | - |
2905 | case QEvent::MouseButtonDblClick: | - |
2906 | case QEvent::MouseMove: | - |
2907 | { | - |
2908 | QWidget* w = static_cast<QWidget *>(receiver); executed (the execution status of this line is deduced): QWidget* w = static_cast<QWidget *>(receiver); | - |
2909 | | - |
2910 | QMouseEvent* mouse = static_cast<QMouseEvent*>(e); executed (the execution status of this line is deduced): QMouseEvent* mouse = static_cast<QMouseEvent*>(e); | - |
2911 | QPoint relpos = mouse->pos(); executed (the execution status of this line is deduced): QPoint relpos = mouse->pos(); | - |
2912 | | - |
2913 | if (e->spontaneous()) { evaluated: e->spontaneous() yes Evaluation Count:11600 | yes Evaluation Count:938 |
| 938-11600 |
2914 | | - |
2915 | if (e->type() == QEvent::MouseButtonPress) { evaluated: e->type() == QEvent::MouseButtonPress yes Evaluation Count:5288 | yes Evaluation Count:6312 |
| 5288-6312 |
2916 | QApplicationPrivate::giveFocusAccordingToFocusPolicy(w, executed (the execution status of this line is deduced): QApplicationPrivate::giveFocusAccordingToFocusPolicy(w, | - |
2917 | Qt::ClickFocus, executed (the execution status of this line is deduced): Qt::ClickFocus, | - |
2918 | Qt::MouseFocusReason); executed (the execution status of this line is deduced): Qt::MouseFocusReason); | - |
2919 | } executed: } Execution Count:5288 | 5288 |
2920 | | - |
2921 | // ### Qt 5 These dynamic tool tips should be an OPT-IN feature. Some platforms | - |
2922 | // like Mac OS X (probably others too), can optimize their views by not | - |
2923 | // dispatching mouse move events. We have attributes to control hover, | - |
2924 | // and mouse tracking, but as long as we are deciding to implement this | - |
2925 | // feature without choice of opting-in or out, you ALWAYS have to have | - |
2926 | // tracking enabled. Therefore, the other properties give a false sense of | - |
2927 | // performance enhancement. | - |
2928 | if (e->type() == QEvent::MouseMove && mouse->buttons() == 0) { evaluated: e->type() == QEvent::MouseMove yes Evaluation Count:675 | yes Evaluation Count:10925 |
evaluated: mouse->buttons() == 0 yes Evaluation Count:674 | yes Evaluation Count:1 |
| 1-10925 |
2929 | d->toolTipWidget = w; executed (the execution status of this line is deduced): d->toolTipWidget = w; | - |
2930 | d->toolTipPos = relpos; executed (the execution status of this line is deduced): d->toolTipPos = relpos; | - |
2931 | d->toolTipGlobalPos = mouse->globalPos(); executed (the execution status of this line is deduced): d->toolTipGlobalPos = mouse->globalPos(); | - |
2932 | d->toolTipWakeUp.start(d->toolTipFallAsleep.isActive()?20:700, this); executed (the execution status of this line is deduced): d->toolTipWakeUp.start(d->toolTipFallAsleep.isActive()?20:700, this); | - |
2933 | } executed: } Execution Count:674 | 674 |
2934 | } executed: } Execution Count:11600 | 11600 |
2935 | | - |
2936 | bool eventAccepted = mouse->isAccepted(); executed (the execution status of this line is deduced): bool eventAccepted = mouse->isAccepted(); | - |
2937 | | - |
2938 | QPointer<QWidget> pw = w; executed (the execution status of this line is deduced): QPointer<QWidget> pw = w; | - |
2939 | while (w) { partially evaluated: w yes Evaluation Count:12559 | no Evaluation Count:0 |
| 0-12559 |
2940 | QMouseEvent me(mouse->type(), relpos, mouse->windowPos(), mouse->globalPos(), mouse->button(), mouse->buttons(), executed (the execution status of this line is deduced): QMouseEvent me(mouse->type(), relpos, mouse->windowPos(), mouse->globalPos(), mouse->button(), mouse->buttons(), | - |
2941 | mouse->modifiers()); executed (the execution status of this line is deduced): mouse->modifiers()); | - |
2942 | me.spont = mouse->spontaneous(); executed (the execution status of this line is deduced): me.spont = mouse->spontaneous(); | - |
2943 | me.setTimestamp(mouse->timestamp()); executed (the execution status of this line is deduced): me.setTimestamp(mouse->timestamp()); | - |
2944 | // throw away any mouse-tracking-only mouse events | - |
2945 | if (!w->hasMouseTracking() evaluated: !w->hasMouseTracking() yes Evaluation Count:11514 | yes Evaluation Count:1045 |
| 1045-11514 |
2946 | && mouse->type() == QEvent::MouseMove && mouse->buttons() == 0) { evaluated: mouse->type() == QEvent::MouseMove yes Evaluation Count:591 | yes Evaluation Count:10923 |
evaluated: mouse->buttons() == 0 yes Evaluation Count:530 | yes Evaluation Count:61 |
| 61-10923 |
2947 | // but still send them through all application event filters (normally done by notify_helper) | - |
2948 | for (int i = 0; d->extraData && i < d->extraData->eventFilters.size(); ++i) { evaluated: d->extraData yes Evaluation Count:130 | yes Evaluation Count:465 |
evaluated: i < d->extraData->eventFilters.size() yes Evaluation Count:65 | yes Evaluation Count:65 |
| 65-465 |
2949 | register QObject *obj = d->extraData->eventFilters.at(i); executed (the execution status of this line is deduced): register QObject *obj = d->extraData->eventFilters.at(i); | - |
2950 | if (!obj) evaluated: !obj yes Evaluation Count:28 | yes Evaluation Count:37 |
| 28-37 |
2951 | continue; executed: continue; Execution Count:28 | 28 |
2952 | if (obj->d_func()->threadData != w->d_func()->threadData) { partially evaluated: obj->d_func()->threadData != w->d_func()->threadData no Evaluation Count:0 | yes Evaluation Count:37 |
| 0-37 |
2953 | qWarning("QApplication: Object event filter cannot be in a different thread."); never executed (the execution status of this line is deduced): QMessageLogger("kernel/qapplication.cpp", 2953, __PRETTY_FUNCTION__).warning("QApplication: Object event filter cannot be in a different thread."); | - |
2954 | continue; never executed: continue; | 0 |
2955 | } | - |
2956 | if (obj->eventFilter(w, w == receiver ? mouse : &me)) partially evaluated: obj->eventFilter(w, w == receiver ? mouse : &me) no Evaluation Count:0 | yes Evaluation Count:37 |
| 0-37 |
2957 | break; | 0 |
2958 | } executed: } Execution Count:37 | 37 |
2959 | res = true; executed (the execution status of this line is deduced): res = true; | - |
2960 | } else { executed: } Execution Count:530 | 530 |
2961 | w->setAttribute(Qt::WA_NoMouseReplay, false); executed (the execution status of this line is deduced): w->setAttribute(Qt::WA_NoMouseReplay, false); | - |
2962 | res = d->notify_helper(w, w == receiver ? mouse : &me); executed (the execution status of this line is deduced): res = d->notify_helper(w, w == receiver ? mouse : &me); | - |
2963 | e->spont = false; executed (the execution status of this line is deduced): e->spont = false; | - |
2964 | } executed: } Execution Count:12029 | 12029 |
2965 | eventAccepted = (w == receiver ? mouse : &me)->isAccepted(); evaluated: w == receiver yes Evaluation Count:12538 | yes Evaluation Count:21 |
| 21-12538 |
2966 | if (res && eventAccepted) evaluated: res yes Evaluation Count:12551 | yes Evaluation Count:8 |
evaluated: eventAccepted yes Evaluation Count:12475 | yes Evaluation Count:76 |
| 8-12551 |
2967 | break; executed: break; Execution Count:12475 | 12475 |
2968 | if (w->isWindow() || w->testAttribute(Qt::WA_NoMousePropagation)) evaluated: w->isWindow() yes Evaluation Count:57 | yes Evaluation Count:27 |
evaluated: w->testAttribute(Qt::WA_NoMousePropagation) yes Evaluation Count:6 | yes Evaluation Count:21 |
| 6-57 |
2969 | break; executed: break; Execution Count:63 | 63 |
2970 | relpos += w->pos(); executed (the execution status of this line is deduced): relpos += w->pos(); | - |
2971 | w = w->parentWidget(); executed (the execution status of this line is deduced): w = w->parentWidget(); | - |
2972 | } executed: } Execution Count:21 | 21 |
2973 | | - |
2974 | mouse->setAccepted(eventAccepted); executed (the execution status of this line is deduced): mouse->setAccepted(eventAccepted); | - |
2975 | | - |
2976 | if (e->type() == QEvent::MouseMove) { evaluated: e->type() == QEvent::MouseMove yes Evaluation Count:1128 | yes Evaluation Count:11410 |
| 1128-11410 |
2977 | if (!pw) evaluated: !pw yes Evaluation Count:1 | yes Evaluation Count:1127 |
| 1-1127 |
2978 | break; executed: break; Execution Count:1 | 1 |
2979 | | - |
2980 | w = static_cast<QWidget *>(receiver); executed (the execution status of this line is deduced): w = static_cast<QWidget *>(receiver); | - |
2981 | relpos = mouse->pos(); executed (the execution status of this line is deduced): relpos = mouse->pos(); | - |
2982 | QPoint diff = relpos - w->mapFromGlobal(d->hoverGlobalPos); executed (the execution status of this line is deduced): QPoint diff = relpos - w->mapFromGlobal(d->hoverGlobalPos); | - |
2983 | while (w) { partially evaluated: w yes Evaluation Count:2908 | no Evaluation Count:0 |
| 0-2908 |
2984 | if (w->testAttribute(Qt::WA_Hover) && evaluated: w->testAttribute(Qt::WA_Hover) yes Evaluation Count:29 | yes Evaluation Count:2879 |
| 29-2879 |
2985 | (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) { evaluated: !QApplication::activePopupWidget() yes Evaluation Count:28 | yes Evaluation Count:1 |
partially evaluated: QApplication::activePopupWidget() == w->window() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-28 |
2986 | QHoverEvent he(QEvent::HoverMove, relpos, relpos - diff, mouse->modifiers()); executed (the execution status of this line is deduced): QHoverEvent he(QEvent::HoverMove, relpos, relpos - diff, mouse->modifiers()); | - |
2987 | d->notify_helper(w, &he); executed (the execution status of this line is deduced): d->notify_helper(w, &he); | - |
2988 | } executed: } Execution Count:28 | 28 |
2989 | if (w->isWindow() || w->testAttribute(Qt::WA_NoMousePropagation)) evaluated: w->isWindow() yes Evaluation Count:1127 | yes Evaluation Count:1781 |
partially evaluated: w->testAttribute(Qt::WA_NoMousePropagation) no Evaluation Count:0 | yes Evaluation Count:1781 |
| 0-1781 |
2990 | break; executed: break; Execution Count:1127 | 1127 |
2991 | relpos += w->pos(); executed (the execution status of this line is deduced): relpos += w->pos(); | - |
2992 | w = w->parentWidget(); executed (the execution status of this line is deduced): w = w->parentWidget(); | - |
2993 | } executed: } Execution Count:1781 | 1781 |
2994 | } executed: } Execution Count:1127 | 1127 |
2995 | | - |
2996 | d->hoverGlobalPos = mouse->globalPos(); executed (the execution status of this line is deduced): d->hoverGlobalPos = mouse->globalPos(); | - |
2997 | } | - |
2998 | break; executed: break; Execution Count:12537 | 12537 |
2999 | #ifndef QT_NO_WHEELEVENT | - |
3000 | case QEvent::Wheel: | - |
3001 | { | - |
3002 | QWidget* w = static_cast<QWidget *>(receiver); executed (the execution status of this line is deduced): QWidget* w = static_cast<QWidget *>(receiver); | - |
3003 | QWheelEvent* wheel = static_cast<QWheelEvent*>(e); executed (the execution status of this line is deduced): QWheelEvent* wheel = static_cast<QWheelEvent*>(e); | - |
3004 | QPoint relpos = wheel->pos(); executed (the execution status of this line is deduced): QPoint relpos = wheel->pos(); | - |
3005 | bool eventAccepted = wheel->isAccepted(); executed (the execution status of this line is deduced): bool eventAccepted = wheel->isAccepted(); | - |
3006 | | - |
3007 | if (e->spontaneous()) { partially evaluated: e->spontaneous() no Evaluation Count:0 | yes Evaluation Count:38 |
| 0-38 |
3008 | QApplicationPrivate::giveFocusAccordingToFocusPolicy(w, never executed (the execution status of this line is deduced): QApplicationPrivate::giveFocusAccordingToFocusPolicy(w, | - |
3009 | Qt::WheelFocus, never executed (the execution status of this line is deduced): Qt::WheelFocus, | - |
3010 | Qt::MouseFocusReason); never executed (the execution status of this line is deduced): Qt::MouseFocusReason); | - |
3011 | } | 0 |
3012 | | - |
3013 | while (w) { partially evaluated: w yes Evaluation Count:42 | no Evaluation Count:0 |
| 0-42 |
3014 | QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(), executed (the execution status of this line is deduced): QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(), | - |
3015 | wheel->modifiers()); executed (the execution status of this line is deduced): wheel->modifiers()); | - |
3016 | we.spont = wheel->spontaneous(); executed (the execution status of this line is deduced): we.spont = wheel->spontaneous(); | - |
3017 | res = d->notify_helper(w, w == receiver ? wheel : &we); executed (the execution status of this line is deduced): res = d->notify_helper(w, w == receiver ? wheel : &we); | - |
3018 | eventAccepted = ((w == receiver) ? wheel : &we)->isAccepted(); evaluated: (w == receiver) yes Evaluation Count:38 | yes Evaluation Count:4 |
| 4-38 |
3019 | e->spont = false; executed (the execution status of this line is deduced): e->spont = false; | - |
3020 | if ((res && eventAccepted) evaluated: res yes Evaluation Count:39 | yes Evaluation Count:3 |
evaluated: eventAccepted yes Evaluation Count:35 | yes Evaluation Count:4 |
| 3-39 |
3021 | || w->isWindow() || w->testAttribute(Qt::WA_NoMousePropagation)) evaluated: w->isWindow() yes Evaluation Count:3 | yes Evaluation Count:4 |
partially evaluated: w->testAttribute(Qt::WA_NoMousePropagation) no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
3022 | break; executed: break; Execution Count:38 | 38 |
3023 | | - |
3024 | relpos += w->pos(); executed (the execution status of this line is deduced): relpos += w->pos(); | - |
3025 | w = w->parentWidget(); executed (the execution status of this line is deduced): w = w->parentWidget(); | - |
3026 | } executed: } Execution Count:4 | 4 |
3027 | wheel->setAccepted(eventAccepted); executed (the execution status of this line is deduced): wheel->setAccepted(eventAccepted); | - |
3028 | } | - |
3029 | break; executed: break; Execution Count:38 | 38 |
3030 | #endif | - |
3031 | #ifndef QT_NO_CONTEXTMENU | - |
3032 | case QEvent::ContextMenu: | - |
3033 | { | - |
3034 | QWidget* w = static_cast<QWidget *>(receiver); executed (the execution status of this line is deduced): QWidget* w = static_cast<QWidget *>(receiver); | - |
3035 | QContextMenuEvent *context = static_cast<QContextMenuEvent*>(e); executed (the execution status of this line is deduced): QContextMenuEvent *context = static_cast<QContextMenuEvent*>(e); | - |
3036 | QPoint relpos = context->pos(); executed (the execution status of this line is deduced): QPoint relpos = context->pos(); | - |
3037 | bool eventAccepted = context->isAccepted(); executed (the execution status of this line is deduced): bool eventAccepted = context->isAccepted(); | - |
3038 | while (w) { partially evaluated: w yes Evaluation Count:305 | no Evaluation Count:0 |
| 0-305 |
3039 | QContextMenuEvent ce(context->reason(), relpos, context->globalPos(), context->modifiers()); executed (the execution status of this line is deduced): QContextMenuEvent ce(context->reason(), relpos, context->globalPos(), context->modifiers()); | - |
3040 | ce.spont = e->spontaneous(); executed (the execution status of this line is deduced): ce.spont = e->spontaneous(); | - |
3041 | res = d->notify_helper(w, w == receiver ? context : &ce); executed (the execution status of this line is deduced): res = d->notify_helper(w, w == receiver ? context : &ce); | - |
3042 | eventAccepted = ((w == receiver) ? context : &ce)->isAccepted(); evaluated: (w == receiver) yes Evaluation Count:205 | yes Evaluation Count:100 |
| 100-205 |
3043 | e->spont = false; executed (the execution status of this line is deduced): e->spont = false; | - |
3044 | | - |
3045 | if ((res && eventAccepted) partially evaluated: res yes Evaluation Count:305 | no Evaluation Count:0 |
evaluated: eventAccepted yes Evaluation Count:105 | yes Evaluation Count:200 |
| 0-305 |
3046 | || w->isWindow() || w->testAttribute(Qt::WA_NoMousePropagation)) evaluated: w->isWindow() yes Evaluation Count:100 | yes Evaluation Count:100 |
partially evaluated: w->testAttribute(Qt::WA_NoMousePropagation) no Evaluation Count:0 | yes Evaluation Count:100 |
| 0-100 |
3047 | break; executed: break; Execution Count:205 | 205 |
3048 | | - |
3049 | relpos += w->pos(); executed (the execution status of this line is deduced): relpos += w->pos(); | - |
3050 | w = w->parentWidget(); executed (the execution status of this line is deduced): w = w->parentWidget(); | - |
3051 | } executed: } Execution Count:100 | 100 |
3052 | context->setAccepted(eventAccepted); executed (the execution status of this line is deduced): context->setAccepted(eventAccepted); | - |
3053 | } | - |
3054 | break; executed: break; Execution Count:205 | 205 |
3055 | #endif // QT_NO_CONTEXTMENU | - |
3056 | #ifndef QT_NO_TABLETEVENT | - |
3057 | case QEvent::TabletMove: | - |
3058 | case QEvent::TabletPress: | - |
3059 | case QEvent::TabletRelease: | - |
3060 | { | - |
3061 | QWidget *w = static_cast<QWidget *>(receiver); never executed (the execution status of this line is deduced): QWidget *w = static_cast<QWidget *>(receiver); | - |
3062 | QTabletEvent *tablet = static_cast<QTabletEvent*>(e); never executed (the execution status of this line is deduced): QTabletEvent *tablet = static_cast<QTabletEvent*>(e); | - |
3063 | QPointF relpos = tablet->posF(); never executed (the execution status of this line is deduced): QPointF relpos = tablet->posF(); | - |
3064 | bool eventAccepted = tablet->isAccepted(); never executed (the execution status of this line is deduced): bool eventAccepted = tablet->isAccepted(); | - |
3065 | while (w) { | 0 |
3066 | QTabletEvent te(tablet->type(), relpos, tablet->globalPosF(), never executed (the execution status of this line is deduced): QTabletEvent te(tablet->type(), relpos, tablet->globalPosF(), | - |
3067 | tablet->device(), tablet->pointerType(), never executed (the execution status of this line is deduced): tablet->device(), tablet->pointerType(), | - |
3068 | tablet->pressure(), tablet->xTilt(), tablet->yTilt(), never executed (the execution status of this line is deduced): tablet->pressure(), tablet->xTilt(), tablet->yTilt(), | - |
3069 | tablet->tangentialPressure(), tablet->rotation(), tablet->z(), never executed (the execution status of this line is deduced): tablet->tangentialPressure(), tablet->rotation(), tablet->z(), | - |
3070 | tablet->modifiers(), tablet->uniqueId()); never executed (the execution status of this line is deduced): tablet->modifiers(), tablet->uniqueId()); | - |
3071 | te.spont = e->spontaneous(); never executed (the execution status of this line is deduced): te.spont = e->spontaneous(); | - |
3072 | res = d->notify_helper(w, w == receiver ? tablet : &te); never executed (the execution status of this line is deduced): res = d->notify_helper(w, w == receiver ? tablet : &te); | - |
3073 | eventAccepted = ((w == receiver) ? tablet : &te)->isAccepted(); never evaluated: (w == receiver) | 0 |
3074 | e->spont = false; never executed (the execution status of this line is deduced): e->spont = false; | - |
3075 | if ((res && eventAccepted) never evaluated: res never evaluated: eventAccepted | 0 |
3076 | || w->isWindow() never evaluated: w->isWindow() | 0 |
3077 | || w->testAttribute(Qt::WA_NoMousePropagation)) never evaluated: w->testAttribute(Qt::WA_NoMousePropagation) | 0 |
3078 | break; | 0 |
3079 | | - |
3080 | relpos += w->pos(); never executed (the execution status of this line is deduced): relpos += w->pos(); | - |
3081 | w = w->parentWidget(); never executed (the execution status of this line is deduced): w = w->parentWidget(); | - |
3082 | } | 0 |
3083 | tablet->setAccepted(eventAccepted); never executed (the execution status of this line is deduced): tablet->setAccepted(eventAccepted); | - |
3084 | qt_tabletChokeMouse = tablet->isAccepted(); never executed (the execution status of this line is deduced): qt_tabletChokeMouse = tablet->isAccepted(); | - |
3085 | } | - |
3086 | break; | 0 |
3087 | #endif // QT_NO_TABLETEVENT | - |
3088 | | - |
3089 | #if !defined(QT_NO_TOOLTIP) || !defined(QT_NO_WHATSTHIS) | - |
3090 | case QEvent::ToolTip: | - |
3091 | case QEvent::WhatsThis: | - |
3092 | case QEvent::QueryWhatsThis: | - |
3093 | { | - |
3094 | QWidget* w = static_cast<QWidget *>(receiver); executed (the execution status of this line is deduced): QWidget* w = static_cast<QWidget *>(receiver); | - |
3095 | QHelpEvent *help = static_cast<QHelpEvent*>(e); executed (the execution status of this line is deduced): QHelpEvent *help = static_cast<QHelpEvent*>(e); | - |
3096 | QPoint relpos = help->pos(); executed (the execution status of this line is deduced): QPoint relpos = help->pos(); | - |
3097 | bool eventAccepted = help->isAccepted(); executed (the execution status of this line is deduced): bool eventAccepted = help->isAccepted(); | - |
3098 | while (w) { partially evaluated: w yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
3099 | QHelpEvent he(help->type(), relpos, help->globalPos()); executed (the execution status of this line is deduced): QHelpEvent he(help->type(), relpos, help->globalPos()); | - |
3100 | he.spont = e->spontaneous(); executed (the execution status of this line is deduced): he.spont = e->spontaneous(); | - |
3101 | res = d->notify_helper(w, w == receiver ? help : &he); executed (the execution status of this line is deduced): res = d->notify_helper(w, w == receiver ? help : &he); | - |
3102 | e->spont = false; executed (the execution status of this line is deduced): e->spont = false; | - |
3103 | eventAccepted = (w == receiver ? help : &he)->isAccepted(); partially evaluated: w == receiver yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
3104 | if ((res && eventAccepted) || w->isWindow()) partially evaluated: res yes Evaluation Count:3 | no Evaluation Count:0 |
evaluated: eventAccepted yes Evaluation Count:2 | yes Evaluation Count:1 |
partially evaluated: w->isWindow() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-3 |
3105 | break; executed: break; Execution Count:3 | 3 |
3106 | | - |
3107 | relpos += w->pos(); never executed (the execution status of this line is deduced): relpos += w->pos(); | - |
3108 | w = w->parentWidget(); never executed (the execution status of this line is deduced): w = w->parentWidget(); | - |
3109 | } | 0 |
3110 | help->setAccepted(eventAccepted); executed (the execution status of this line is deduced): help->setAccepted(eventAccepted); | - |
3111 | } | - |
3112 | break; executed: break; Execution Count:3 | 3 |
3113 | #endif | - |
3114 | #if !defined(QT_NO_STATUSTIP) || !defined(QT_NO_WHATSTHIS) | - |
3115 | case QEvent::StatusTip: | - |
3116 | case QEvent::WhatsThisClicked: | - |
3117 | { | - |
3118 | QWidget *w = static_cast<QWidget *>(receiver); executed (the execution status of this line is deduced): QWidget *w = static_cast<QWidget *>(receiver); | - |
3119 | while (w) { partially evaluated: w yes Evaluation Count:215 | no Evaluation Count:0 |
| 0-215 |
3120 | res = d->notify_helper(w, e); executed (the execution status of this line is deduced): res = d->notify_helper(w, e); | - |
3121 | if ((res && e->isAccepted()) || w->isWindow()) evaluated: res yes Evaluation Count:85 | yes Evaluation Count:130 |
evaluated: e->isAccepted() yes Evaluation Count:2 | yes Evaluation Count:83 |
evaluated: w->isWindow() yes Evaluation Count:126 | yes Evaluation Count:87 |
| 2-130 |
3122 | break; executed: break; Execution Count:128 | 128 |
3123 | w = w->parentWidget(); executed (the execution status of this line is deduced): w = w->parentWidget(); | - |
3124 | } executed: } Execution Count:87 | 87 |
3125 | } | - |
3126 | break; executed: break; Execution Count:128 | 128 |
3127 | #endif | - |
3128 | | - |
3129 | #ifndef QT_NO_DRAGANDDROP | - |
3130 | case QEvent::DragEnter: { | - |
3131 | QWidget* w = static_cast<QWidget *>(receiver); executed (the execution status of this line is deduced): QWidget* w = static_cast<QWidget *>(receiver); | - |
3132 | QDragEnterEvent *dragEvent = static_cast<QDragEnterEvent *>(e); executed (the execution status of this line is deduced): QDragEnterEvent *dragEvent = static_cast<QDragEnterEvent *>(e); | - |
3133 | #ifndef QT_NO_GRAPHICSVIEW | - |
3134 | // QGraphicsProxyWidget handles its own propagation, | - |
3135 | // and we must not change QDragManagers currentTarget. | - |
3136 | QWExtra *extra = w->window()->d_func()->extra; executed (the execution status of this line is deduced): QWExtra *extra = w->window()->d_func()->extra; | - |
3137 | if (extra && extra->proxyWidget) { partially evaluated: extra yes Evaluation Count:3 | no Evaluation Count:0 |
partially evaluated: extra->proxyWidget no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
3138 | res = d->notify_helper(w, dragEvent); never executed (the execution status of this line is deduced): res = d->notify_helper(w, dragEvent); | - |
3139 | break; | 0 |
3140 | } | - |
3141 | #endif | - |
3142 | while (w) { partially evaluated: w yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
3143 | if (w->isEnabled() && w->acceptDrops()) { partially evaluated: w->isEnabled() yes Evaluation Count:3 | no Evaluation Count:0 |
partially evaluated: w->acceptDrops() yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
3144 | res = d->notify_helper(w, dragEvent); executed (the execution status of this line is deduced): res = d->notify_helper(w, dragEvent); | - |
3145 | if (res && dragEvent->isAccepted()) { partially evaluated: res yes Evaluation Count:3 | no Evaluation Count:0 |
partially evaluated: dragEvent->isAccepted() yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
3146 | QDragManager::self()->setCurrentTarget(w); executed (the execution status of this line is deduced): QDragManager::self()->setCurrentTarget(w); | - |
3147 | break; executed: break; Execution Count:3 | 3 |
3148 | } | - |
3149 | } | 0 |
3150 | if (w->isWindow()) never evaluated: w->isWindow() | 0 |
3151 | break; | 0 |
3152 | dragEvent->p = w->mapToParent(dragEvent->p.toPoint()); never executed (the execution status of this line is deduced): dragEvent->p = w->mapToParent(dragEvent->p.toPoint()); | - |
3153 | w = w->parentWidget(); never executed (the execution status of this line is deduced): w = w->parentWidget(); | - |
3154 | } | 0 |
3155 | } | - |
3156 | break; executed: break; Execution Count:3 | 3 |
3157 | case QEvent::DragMove: | - |
3158 | case QEvent::Drop: | - |
3159 | case QEvent::DragLeave: { | - |
3160 | QWidget* w = static_cast<QWidget *>(receiver); executed (the execution status of this line is deduced): QWidget* w = static_cast<QWidget *>(receiver); | - |
3161 | #ifndef QT_NO_GRAPHICSVIEW | - |
3162 | // QGraphicsProxyWidget handles its own propagation, | - |
3163 | // and we must not change QDragManagers currentTarget. | - |
3164 | QWExtra *extra = w->window()->d_func()->extra; executed (the execution status of this line is deduced): QWExtra *extra = w->window()->d_func()->extra; | - |
3165 | bool isProxyWidget = extra && extra->proxyWidget; partially evaluated: extra yes Evaluation Count:8 | no Evaluation Count:0 |
partially evaluated: extra->proxyWidget no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
3166 | if (!isProxyWidget) partially evaluated: !isProxyWidget yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
3167 | #endif | - |
3168 | w = qobject_cast<QWidget *>(QDragManager::self()->currentTarget()); executed: w = qobject_cast<QWidget *>(QDragManager::self()->currentTarget()); Execution Count:8 | 8 |
3169 | | - |
3170 | if (!w) { partially evaluated: !w no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
3171 | break; | 0 |
3172 | } | - |
3173 | if (e->type() == QEvent::DragMove || e->type() == QEvent::Drop) { evaluated: e->type() == QEvent::DragMove yes Evaluation Count:5 | yes Evaluation Count:3 |
evaluated: e->type() == QEvent::Drop yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-5 |
3174 | QDropEvent *dragEvent = static_cast<QDropEvent *>(e); executed (the execution status of this line is deduced): QDropEvent *dragEvent = static_cast<QDropEvent *>(e); | - |
3175 | QWidget *origReciver = static_cast<QWidget *>(receiver); executed (the execution status of this line is deduced): QWidget *origReciver = static_cast<QWidget *>(receiver); | - |
3176 | while (origReciver && w != origReciver) { partially evaluated: origReciver yes Evaluation Count:7 | no Evaluation Count:0 |
partially evaluated: w != origReciver no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
3177 | dragEvent->p = origReciver->mapToParent(dragEvent->p.toPoint()); never executed (the execution status of this line is deduced): dragEvent->p = origReciver->mapToParent(dragEvent->p.toPoint()); | - |
3178 | origReciver = origReciver->parentWidget(); never executed (the execution status of this line is deduced): origReciver = origReciver->parentWidget(); | - |
3179 | } | 0 |
3180 | } executed: } Execution Count:7 | 7 |
3181 | res = d->notify_helper(w, e); executed (the execution status of this line is deduced): res = d->notify_helper(w, e); | - |
3182 | if (e->type() != QEvent::DragMove evaluated: e->type() != QEvent::DragMove yes Evaluation Count:3 | yes Evaluation Count:5 |
| 3-5 |
3183 | #ifndef QT_NO_GRAPHICSVIEW executed (the execution status of this line is deduced):
| - |
3184 | && !isProxyWidget partially evaluated: !isProxyWidget yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
3185 | #endif | - |
3186 | ) | - |
3187 | QDragManager::self()->setCurrentTarget(0, e->type() == QEvent::Drop); executed: QDragManager::self()->setCurrentTarget(0, e->type() == QEvent::Drop); Execution Count:3 | 3 |
3188 | } | - |
3189 | break; executed: break; Execution Count:8 | 8 |
3190 | #endif | - |
3191 | | - |
3192 | case QEvent::TouchUpdate: | - |
3193 | case QEvent::TouchEnd: | - |
3194 | { | - |
3195 | QWidget *widget = static_cast<QWidget *>(receiver); executed (the execution status of this line is deduced): QWidget *widget = static_cast<QWidget *>(receiver); | - |
3196 | QTouchEvent *touchEvent = static_cast<QTouchEvent *>(e); executed (the execution status of this line is deduced): QTouchEvent *touchEvent = static_cast<QTouchEvent *>(e); | - |
3197 | const bool acceptTouchEvents = widget->testAttribute(Qt::WA_AcceptTouchEvents); executed (the execution status of this line is deduced): const bool acceptTouchEvents = widget->testAttribute(Qt::WA_AcceptTouchEvents); | - |
3198 | | - |
3199 | touchEvent->setTarget(widget); executed (the execution status of this line is deduced): touchEvent->setTarget(widget); | - |
3200 | touchEvent->setAccepted(acceptTouchEvents); executed (the execution status of this line is deduced): touchEvent->setAccepted(acceptTouchEvents); | - |
3201 | | - |
3202 | res = acceptTouchEvents && d->notify_helper(widget, touchEvent); evaluated: acceptTouchEvents yes Evaluation Count:20 | yes Evaluation Count:3 |
evaluated: d->notify_helper(widget, touchEvent) yes Evaluation Count:6 | yes Evaluation Count:14 |
| 3-20 |
3203 | | - |
3204 | // If the touch event wasn't accepted, synthesize a mouse event and see if the widget wants it. | - |
3205 | if (!touchEvent->isAccepted()) evaluated: !touchEvent->isAccepted() yes Evaluation Count:4 | yes Evaluation Count:19 |
| 4-19 |
3206 | res = d->translateTouchToMouse(widget, touchEvent); executed: res = d->translateTouchToMouse(widget, touchEvent); Execution Count:4 | 4 |
3207 | break; executed: break; Execution Count:23 | 23 |
3208 | } | - |
3209 | | - |
3210 | case QEvent::TouchBegin: | - |
3211 | // Note: TouchUpdate and TouchEnd events are never propagated | - |
3212 | { | - |
3213 | QWidget *widget = static_cast<QWidget *>(receiver); executed (the execution status of this line is deduced): QWidget *widget = static_cast<QWidget *>(receiver); | - |
3214 | QTouchEvent *touchEvent = static_cast<QTouchEvent *>(e); executed (the execution status of this line is deduced): QTouchEvent *touchEvent = static_cast<QTouchEvent *>(e); | - |
3215 | bool eventAccepted = touchEvent->isAccepted(); executed (the execution status of this line is deduced): bool eventAccepted = touchEvent->isAccepted(); | - |
3216 | if (widget->testAttribute(Qt::WA_AcceptTouchEvents) && e->spontaneous()) { evaluated: widget->testAttribute(Qt::WA_AcceptTouchEvents) yes Evaluation Count:14 | yes Evaluation Count:8 |
evaluated: e->spontaneous() yes Evaluation Count:7 | yes Evaluation Count:7 |
| 7-14 |
3217 | // give the widget focus if the focus policy allows it | - |
3218 | QApplicationPrivate::giveFocusAccordingToFocusPolicy(widget, executed (the execution status of this line is deduced): QApplicationPrivate::giveFocusAccordingToFocusPolicy(widget, | - |
3219 | Qt::ClickFocus, executed (the execution status of this line is deduced): Qt::ClickFocus, | - |
3220 | Qt::MouseFocusReason); executed (the execution status of this line is deduced): Qt::MouseFocusReason); | - |
3221 | } executed: } Execution Count:7 | 7 |
3222 | | - |
3223 | while (widget) { partially evaluated: widget yes Evaluation Count:28 | no Evaluation Count:0 |
| 0-28 |
3224 | // first, try to deliver the touch event | - |
3225 | bool acceptTouchEvents = widget->testAttribute(Qt::WA_AcceptTouchEvents); executed (the execution status of this line is deduced): bool acceptTouchEvents = widget->testAttribute(Qt::WA_AcceptTouchEvents); | - |
3226 | touchEvent->setTarget(widget); executed (the execution status of this line is deduced): touchEvent->setTarget(widget); | - |
3227 | touchEvent->setAccepted(acceptTouchEvents); executed (the execution status of this line is deduced): touchEvent->setAccepted(acceptTouchEvents); | - |
3228 | QPointer<QWidget> p = widget; executed (the execution status of this line is deduced): QPointer<QWidget> p = widget; | - |
3229 | res = acceptTouchEvents && d->notify_helper(widget, touchEvent); evaluated: acceptTouchEvents yes Evaluation Count:17 | yes Evaluation Count:11 |
evaluated: d->notify_helper(widget, touchEvent) yes Evaluation Count:10 | yes Evaluation Count:7 |
| 7-17 |
3230 | | - |
3231 | // If the touch event wasn't accepted, synthesize a mouse event and see if the widget wants it. | - |
3232 | if (!touchEvent->isAccepted()) { evaluated: !touchEvent->isAccepted() yes Evaluation Count:16 | yes Evaluation Count:12 |
| 12-16 |
3233 | res = d->translateTouchToMouse(widget, touchEvent); executed (the execution status of this line is deduced): res = d->translateTouchToMouse(widget, touchEvent); | - |
3234 | eventAccepted = touchEvent->isAccepted(); executed (the execution status of this line is deduced): eventAccepted = touchEvent->isAccepted(); | - |
3235 | if (eventAccepted) evaluated: eventAccepted yes Evaluation Count:4 | yes Evaluation Count:12 |
| 4-12 |
3236 | break; executed: break; Execution Count:4 | 4 |
3237 | } executed: } Execution Count:12 | 12 |
3238 | | - |
3239 | eventAccepted = touchEvent->isAccepted(); executed (the execution status of this line is deduced): eventAccepted = touchEvent->isAccepted(); | - |
3240 | if (p.isNull()) { partially evaluated: p.isNull() no Evaluation Count:0 | yes Evaluation Count:24 |
| 0-24 |
3241 | // widget was deleted | - |
3242 | widget = 0; never executed (the execution status of this line is deduced): widget = 0; | - |
3243 | } else { | 0 |
3244 | widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, res && eventAccepted); executed (the execution status of this line is deduced): widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, res && eventAccepted); | - |
3245 | } executed: } Execution Count:24 | 24 |
3246 | touchEvent->spont = false; executed (the execution status of this line is deduced): touchEvent->spont = false; | - |
3247 | if (res && eventAccepted) { evaluated: res yes Evaluation Count:5 | yes Evaluation Count:19 |
partially evaluated: eventAccepted yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-19 |
3248 | // the first widget to accept the TouchBegin gets an implicit grab. | - |
3249 | for (int i = 0; i < touchEvent->touchPoints().count(); ++i) { evaluated: i < touchEvent->touchPoints().count() yes Evaluation Count:5 | yes Evaluation Count:5 |
| 5 |
3250 | const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().at(i); executed (the execution status of this line is deduced): const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().at(i); | - |
3251 | d->activeTouchPoints[QGuiApplicationPrivate::ActiveTouchPointsKey(touchEvent->device(), touchPoint.id())].target = widget; executed (the execution status of this line is deduced): d->activeTouchPoints[QGuiApplicationPrivate::ActiveTouchPointsKey(touchEvent->device(), touchPoint.id())].target = widget; | - |
3252 | } executed: } Execution Count:5 | 5 |
3253 | break; executed: break; Execution Count:5 | 5 |
3254 | } else if (p.isNull() || widget->isWindow() || widget->testAttribute(Qt::WA_NoMousePropagation)) { partially evaluated: p.isNull() no Evaluation Count:0 | yes Evaluation Count:19 |
evaluated: widget->isWindow() yes Evaluation Count:13 | yes Evaluation Count:6 |
partially evaluated: widget->testAttribute(Qt::WA_NoMousePropagation) no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-19 |
3255 | break; executed: break; Execution Count:13 | 13 |
3256 | } | - |
3257 | QPoint offset = widget->pos(); executed (the execution status of this line is deduced): QPoint offset = widget->pos(); | - |
3258 | widget = widget->parentWidget(); executed (the execution status of this line is deduced): widget = widget->parentWidget(); | - |
3259 | touchEvent->setTarget(widget); executed (the execution status of this line is deduced): touchEvent->setTarget(widget); | - |
3260 | for (int i = 0; i < touchEvent->_touchPoints.size(); ++i) { evaluated: i < touchEvent->_touchPoints.size() yes Evaluation Count:6 | yes Evaluation Count:6 |
| 6 |
3261 | QTouchEvent::TouchPoint &pt = touchEvent->_touchPoints[i]; executed (the execution status of this line is deduced): QTouchEvent::TouchPoint &pt = touchEvent->_touchPoints[i]; | - |
3262 | QRectF rect = pt.rect(); executed (the execution status of this line is deduced): QRectF rect = pt.rect(); | - |
3263 | rect.moveCenter(offset); executed (the execution status of this line is deduced): rect.moveCenter(offset); | - |
3264 | pt.d->rect = rect; executed (the execution status of this line is deduced): pt.d->rect = rect; | - |
3265 | pt.d->startPos = pt.startPos() + offset; executed (the execution status of this line is deduced): pt.d->startPos = pt.startPos() + offset; | - |
3266 | pt.d->lastPos = pt.lastPos() + offset; executed (the execution status of this line is deduced): pt.d->lastPos = pt.lastPos() + offset; | - |
3267 | } executed: } Execution Count:6 | 6 |
3268 | } executed: } Execution Count:6 | 6 |
3269 | | - |
3270 | touchEvent->setAccepted(eventAccepted); executed (the execution status of this line is deduced): touchEvent->setAccepted(eventAccepted); | - |
3271 | break; executed: break; Execution Count:22 | 22 |
3272 | } | - |
3273 | case QEvent::RequestSoftwareInputPanel: | - |
3274 | inputMethod()->show(); never executed (the execution status of this line is deduced): inputMethod()->show(); | - |
3275 | break; | 0 |
3276 | case QEvent::CloseSoftwareInputPanel: | - |
3277 | inputMethod()->hide(); never executed (the execution status of this line is deduced): inputMethod()->hide(); | - |
3278 | break; | 0 |
3279 | | - |
3280 | #ifndef QT_NO_GESTURES | - |
3281 | case QEvent::NativeGesture: | - |
3282 | { | - |
3283 | // only propagate the first gesture event (after the GID_BEGIN) | - |
3284 | QWidget *w = static_cast<QWidget *>(receiver); never executed (the execution status of this line is deduced): QWidget *w = static_cast<QWidget *>(receiver); | - |
3285 | while (w) { | 0 |
3286 | e->ignore(); never executed (the execution status of this line is deduced): e->ignore(); | - |
3287 | res = d->notify_helper(w, e); never executed (the execution status of this line is deduced): res = d->notify_helper(w, e); | - |
3288 | if ((res && e->isAccepted()) || w->isWindow()) never evaluated: res never evaluated: e->isAccepted() never evaluated: w->isWindow() | 0 |
3289 | break; | 0 |
3290 | w = w->parentWidget(); never executed (the execution status of this line is deduced): w = w->parentWidget(); | - |
3291 | } | 0 |
3292 | break; | 0 |
3293 | } | - |
3294 | case QEvent::Gesture: | - |
3295 | case QEvent::GestureOverride: | - |
3296 | { | - |
3297 | if (receiver->isWidgetType()) { partially evaluated: receiver->isWidgetType() yes Evaluation Count:268 | no Evaluation Count:0 |
| 0-268 |
3298 | QWidget *w = static_cast<QWidget *>(receiver); executed (the execution status of this line is deduced): QWidget *w = static_cast<QWidget *>(receiver); | - |
3299 | QGestureEvent *gestureEvent = static_cast<QGestureEvent *>(e); executed (the execution status of this line is deduced): QGestureEvent *gestureEvent = static_cast<QGestureEvent *>(e); | - |
3300 | QList<QGesture *> allGestures = gestureEvent->gestures(); executed (the execution status of this line is deduced): QList<QGesture *> allGestures = gestureEvent->gestures(); | - |
3301 | | - |
3302 | bool eventAccepted = gestureEvent->isAccepted(); executed (the execution status of this line is deduced): bool eventAccepted = gestureEvent->isAccepted(); | - |
3303 | bool wasAccepted = eventAccepted; executed (the execution status of this line is deduced): bool wasAccepted = eventAccepted; | - |
3304 | while (w) { partially evaluated: w yes Evaluation Count:340 | no Evaluation Count:0 |
| 0-340 |
3305 | // send only gestures the widget expects | - |
3306 | QList<QGesture *> gestures; executed (the execution status of this line is deduced): QList<QGesture *> gestures; | - |
3307 | QWidgetPrivate *wd = w->d_func(); executed (the execution status of this line is deduced): QWidgetPrivate *wd = w->d_func(); | - |
3308 | for (int i = 0; i < allGestures.size();) { evaluated: i < allGestures.size() yes Evaluation Count:414 | yes Evaluation Count:340 |
| 340-414 |
3309 | QGesture *g = allGestures.at(i); executed (the execution status of this line is deduced): QGesture *g = allGestures.at(i); | - |
3310 | Qt::GestureType type = g->gestureType(); executed (the execution status of this line is deduced): Qt::GestureType type = g->gestureType(); | - |
3311 | QMap<Qt::GestureType, Qt::GestureFlags>::iterator contextit = executed (the execution status of this line is deduced): QMap<Qt::GestureType, Qt::GestureFlags>::iterator contextit = | - |
3312 | wd->gestureContext.find(type); executed (the execution status of this line is deduced): wd->gestureContext.find(type); | - |
3313 | bool deliver = contextit != wd->gestureContext.end() && evaluated: contextit != wd->gestureContext.end() yes Evaluation Count:366 | yes Evaluation Count:48 |
| 48-366 |
3314 | (g->state() == Qt::GestureStarted || w == receiver || evaluated: g->state() == Qt::GestureStarted yes Evaluation Count:122 | yes Evaluation Count:244 |
evaluated: w == receiver yes Evaluation Count:202 | yes Evaluation Count:42 |
| 42-244 |
3315 | (contextit.value() & Qt::ReceivePartialGestures)); evaluated: (contextit.value() & Qt::ReceivePartialGestures) yes Evaluation Count:39 | yes Evaluation Count:3 |
| 3-39 |
3316 | if (deliver) { evaluated: deliver yes Evaluation Count:363 | yes Evaluation Count:51 |
| 51-363 |
3317 | allGestures.removeAt(i); executed (the execution status of this line is deduced): allGestures.removeAt(i); | - |
3318 | gestures.append(g); executed (the execution status of this line is deduced): gestures.append(g); | - |
3319 | } else { executed: } Execution Count:363 | 363 |
3320 | ++i; executed (the execution status of this line is deduced): ++i; | - |
3321 | } executed: } Execution Count:51 | 51 |
3322 | } | - |
3323 | if (!gestures.isEmpty()) { // we have gestures for this w evaluated: !gestures.isEmpty() yes Evaluation Count:319 | yes Evaluation Count:21 |
| 21-319 |
3324 | QGestureEvent ge(gestures); executed (the execution status of this line is deduced): QGestureEvent ge(gestures); | - |
3325 | ge.t = gestureEvent->t; executed (the execution status of this line is deduced): ge.t = gestureEvent->t; | - |
3326 | ge.spont = gestureEvent->spont; executed (the execution status of this line is deduced): ge.spont = gestureEvent->spont; | - |
3327 | ge.m_accept = wasAccepted; executed (the execution status of this line is deduced): ge.m_accept = wasAccepted; | - |
3328 | ge.m_accepted = gestureEvent->m_accepted; executed (the execution status of this line is deduced): ge.m_accepted = gestureEvent->m_accepted; | - |
3329 | res = d->notify_helper(w, &ge); executed (the execution status of this line is deduced): res = d->notify_helper(w, &ge); | - |
3330 | gestureEvent->spont = false; executed (the execution status of this line is deduced): gestureEvent->spont = false; | - |
3331 | eventAccepted = ge.isAccepted(); executed (the execution status of this line is deduced): eventAccepted = ge.isAccepted(); | - |
3332 | for (int i = 0; i < gestures.size(); ++i) { evaluated: i < gestures.size() yes Evaluation Count:363 | yes Evaluation Count:319 |
| 319-363 |
3333 | QGesture *g = gestures.at(i); executed (the execution status of this line is deduced): QGesture *g = gestures.at(i); | - |
3334 | // Ignore res [event return value] because handling of multiple gestures | - |
3335 | // packed into a single QEvent depends on not consuming the event | - |
3336 | if (eventAccepted || ge.isAccepted(g)) { evaluated: eventAccepted yes Evaluation Count:221 | yes Evaluation Count:142 |
evaluated: ge.isAccepted(g) yes Evaluation Count:10 | yes Evaluation Count:132 |
| 10-221 |
3337 | // if the gesture was accepted, mark the target widget for it | - |
3338 | gestureEvent->m_targetWidgets[g->gestureType()] = w; executed (the execution status of this line is deduced): gestureEvent->m_targetWidgets[g->gestureType()] = w; | - |
3339 | gestureEvent->setAccepted(g, true); executed (the execution status of this line is deduced): gestureEvent->setAccepted(g, true); | - |
3340 | } else { executed: } Execution Count:231 | 231 |
3341 | // if the gesture was explicitly ignored by the application, | - |
3342 | // put it back so a parent can get it | - |
3343 | allGestures.append(g); executed (the execution status of this line is deduced): allGestures.append(g); | - |
3344 | } executed: } Execution Count:132 | 132 |
3345 | } | - |
3346 | } executed: } Execution Count:319 | 319 |
3347 | if (allGestures.isEmpty()) // everything delivered evaluated: allGestures.isEmpty() yes Evaluation Count:225 | yes Evaluation Count:115 |
| 115-225 |
3348 | break; executed: break; Execution Count:225 | 225 |
3349 | if (w->isWindow()) evaluated: w->isWindow() yes Evaluation Count:43 | yes Evaluation Count:72 |
| 43-72 |
3350 | break; executed: break; Execution Count:43 | 43 |
3351 | w = w->parentWidget(); executed (the execution status of this line is deduced): w = w->parentWidget(); | - |
3352 | } executed: } Execution Count:72 | 72 |
3353 | foreach (QGesture *g, allGestures) executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(allGestures)> _container_(allGestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *g = *_container_.i;; __extension__ ({--_container_.brk; break;})) | - |
3354 | gestureEvent->setAccepted(g, false); executed: gestureEvent->setAccepted(g, false); Execution Count:61 | 61 |
3355 | gestureEvent->m_accept = false; // to make sure we check individual gestures executed (the execution status of this line is deduced): gestureEvent->m_accept = false; | - |
3356 | } else { executed: } Execution Count:268 | 268 |
3357 | res = d->notify_helper(receiver, e); never executed (the execution status of this line is deduced): res = d->notify_helper(receiver, e); | - |
3358 | } | 0 |
3359 | break; executed: break; Execution Count:268 | 268 |
3360 | } | - |
3361 | #endif // QT_NO_GESTURES | - |
3362 | default: | - |
3363 | res = d->notify_helper(receiver, e); executed (the execution status of this line is deduced): res = d->notify_helper(receiver, e); | - |
3364 | break; executed: break; Execution Count:557597 | 557597 |
3365 | } | 0 |
3366 | | - |
3367 | return res; executed: return res; Execution Count:661893 | 661893 |
3368 | } | - |
3369 | | - |
3370 | bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) | - |
3371 | { | - |
3372 | // send to all application event filters | - |
3373 | if (sendThroughApplicationEventFilters(receiver, e)) evaluated: sendThroughApplicationEventFilters(receiver, e) yes Evaluation Count:1 | yes Evaluation Count:664363 |
| 1-664363 |
3374 | return true; executed: return true; Execution Count:1 | 1 |
3375 | | - |
3376 | if (receiver->isWidgetType()) { evaluated: receiver->isWidgetType() yes Evaluation Count:589379 | yes Evaluation Count:74988 |
| 74988-589379 |
3377 | QWidget *widget = static_cast<QWidget *>(receiver); executed (the execution status of this line is deduced): QWidget *widget = static_cast<QWidget *>(receiver); | - |
3378 | | - |
3379 | #if !defined(Q_OS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR)) | - |
3380 | // toggle HasMouse widget state on enter and leave | - |
3381 | if ((e->type() == QEvent::Enter || e->type() == QEvent::DragEnter) && evaluated: e->type() == QEvent::Enter yes Evaluation Count:2847 | yes Evaluation Count:586532 |
evaluated: e->type() == QEvent::DragEnter yes Evaluation Count:3 | yes Evaluation Count:586529 |
| 3-586532 |
3382 | (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == widget->window())) evaluated: !QApplication::activePopupWidget() yes Evaluation Count:2813 | yes Evaluation Count:37 |
evaluated: QApplication::activePopupWidget() == widget->window() yes Evaluation Count:7 | yes Evaluation Count:30 |
| 7-2813 |
3383 | widget->setAttribute(Qt::WA_UnderMouse, true); executed: widget->setAttribute(Qt::WA_UnderMouse, true); Execution Count:2820 | 2820 |
3384 | else if (e->type() == QEvent::Leave || e->type() == QEvent::DragLeave) evaluated: e->type() == QEvent::Leave yes Evaluation Count:964 | yes Evaluation Count:585595 |
evaluated: e->type() == QEvent::DragLeave yes Evaluation Count:1 | yes Evaluation Count:585594 |
| 1-585595 |
3385 | widget->setAttribute(Qt::WA_UnderMouse, false); executed: widget->setAttribute(Qt::WA_UnderMouse, false); Execution Count:965 | 965 |
3386 | #endif | - |
3387 | | - |
3388 | if (QLayout *layout=widget->d_func()->layout) { evaluated: QLayout *layout=widget->d_func()->layout yes Evaluation Count:105401 | yes Evaluation Count:483978 |
| 105401-483978 |
3389 | layout->widgetEvent(e); executed (the execution status of this line is deduced): layout->widgetEvent(e); | - |
3390 | } executed: } Execution Count:105401 | 105401 |
3391 | } executed: } Execution Count:589379 | 589379 |
3392 | | - |
3393 | // send to all receiver event filters | - |
3394 | if (sendThroughObjectEventFilters(receiver, e)) evaluated: sendThroughObjectEventFilters(receiver, e) yes Evaluation Count:20446 | yes Evaluation Count:643915 |
| 20446-643915 |
3395 | return true; executed: return true; Execution Count:20446 | 20446 |
3396 | | - |
3397 | // deliver the event | - |
3398 | bool consumed = receiver->event(e); executed (the execution status of this line is deduced): bool consumed = receiver->event(e); | - |
3399 | e->spont = false; executed (the execution status of this line is deduced): e->spont = false; | - |
3400 | return consumed; executed: return consumed; Execution Count:643915 | 643915 |
3401 | } | - |
3402 | | - |
3403 | bool QApplicationPrivate::inPopupMode() | - |
3404 | { | - |
3405 | return QApplicationPrivate::popupWidgets != 0; executed: return QApplicationPrivate::popupWidgets != 0; Execution Count:2288 | 2288 |
3406 | } | - |
3407 | | - |
3408 | #ifdef QT_KEYPAD_NAVIGATION | - |
3409 | /*! | - |
3410 | Sets the kind of focus navigation Qt should use to \a mode. | - |
3411 | | - |
3412 | This feature is available in Qt for Embedded Linux, and Windows CE | - |
3413 | only. | - |
3414 | | - |
3415 | \note On Windows CE this feature is disabled by default for touch device | - |
3416 | mkspecs. To enable keypad navigation, build Qt with | - |
3417 | QT_KEYPAD_NAVIGATION defined. | - |
3418 | | - |
3419 | \since 4.6 | - |
3420 | | - |
3421 | \sa keypadNavigationEnabled() | - |
3422 | */ | - |
3423 | void QApplication::setNavigationMode(Qt::NavigationMode mode) | - |
3424 | { | - |
3425 | QApplicationPrivate::navigationMode = mode; | - |
3426 | } | - |
3427 | | - |
3428 | /*! | - |
3429 | Returns what kind of focus navigation Qt is using. | - |
3430 | | - |
3431 | This feature is available in Qt for Embedded Linux, and Windows CE only. | - |
3432 | | - |
3433 | \note On Windows CE this feature is disabled by default for touch device | - |
3434 | mkspecs. To enable keypad navigation, build Qt with | - |
3435 | QT_KEYPAD_NAVIGATION defined. | - |
3436 | | - |
3437 | \since 4.6 | - |
3438 | | - |
3439 | \sa keypadNavigationEnabled() | - |
3440 | */ | - |
3441 | Qt::NavigationMode QApplication::navigationMode() | - |
3442 | { | - |
3443 | return QApplicationPrivate::navigationMode; | - |
3444 | } | - |
3445 | | - |
3446 | /*! | - |
3447 | Sets whether Qt should use focus navigation suitable for use with a | - |
3448 | minimal keypad. | - |
3449 | | - |
3450 | This feature is available in Qt for Embedded Linux, and Windows CE only. | - |
3451 | | - |
3452 | \note On Windows CE this feature is disabled by default for touch device | - |
3453 | mkspecs. To enable keypad navigation, build Qt with | - |
3454 | QT_KEYPAD_NAVIGATION defined. | - |
3455 | | - |
3456 | \deprecated | - |
3457 | | - |
3458 | \sa setNavigationMode() | - |
3459 | */ | - |
3460 | void QApplication::setKeypadNavigationEnabled(bool enable) | - |
3461 | { | - |
3462 | if (enable) { | - |
3463 | QApplication::setNavigationMode(Qt::NavigationModeKeypadTabOrder); | - |
3464 | } else { | - |
3465 | QApplication::setNavigationMode(Qt::NavigationModeNone); | - |
3466 | } | - |
3467 | } | - |
3468 | | - |
3469 | /*! | - |
3470 | Returns true if Qt is set to use keypad navigation; otherwise returns | - |
3471 | false. The default value is false. | - |
3472 | | - |
3473 | This feature is available in Qt for Embedded Linux, and Windows CE only. | - |
3474 | | - |
3475 | \note On Windows CE this feature is disabled by default for touch device | - |
3476 | mkspecs. To enable keypad navigation, build Qt with | - |
3477 | QT_KEYPAD_NAVIGATION defined. | - |
3478 | | - |
3479 | \deprecated | - |
3480 | | - |
3481 | \sa navigationMode() | - |
3482 | */ | - |
3483 | bool QApplication::keypadNavigationEnabled() | - |
3484 | { | - |
3485 | return QApplicationPrivate::navigationMode == Qt::NavigationModeKeypadTabOrder || | - |
3486 | QApplicationPrivate::navigationMode == Qt::NavigationModeKeypadDirectional; | - |
3487 | } | - |
3488 | #endif | - |
3489 | | - |
3490 | /*! | - |
3491 | \fn void QApplication::alert(QWidget *widget, int msec) | - |
3492 | \since 4.3 | - |
3493 | | - |
3494 | Causes an alert to be shown for \a widget if the window is not the active | - |
3495 | window. The alert is shown for \a msec miliseconds. If \a msec is zero (the | - |
3496 | default), then the alert is shown indefinitely until the window becomes | - |
3497 | active again. | - |
3498 | | - |
3499 | Currently this function does nothing on Qt for Embedded Linux. | - |
3500 | | - |
3501 | On Mac OS X, this works more at the application level and will cause the | - |
3502 | application icon to bounce in the dock. | - |
3503 | | - |
3504 | On Windows, this causes the window's taskbar entry to flash for a time. If | - |
3505 | \a msec is zero, the flashing will stop and the taskbar entry will turn a | - |
3506 | different color (currently orange). | - |
3507 | | - |
3508 | On X11, this will cause the window to be marked as "demands attention", the | - |
3509 | window must not be hidden (i.e. not have hide() called on it, but be | - |
3510 | visible in some sort of way) in order for this to work. | - |
3511 | */ | - |
3512 | | - |
3513 | /*! | - |
3514 | \property QApplication::cursorFlashTime | - |
3515 | \brief the text cursor's flash (blink) time in milliseconds | - |
3516 | | - |
3517 | The flash time is the time required to display, invert and restore the | - |
3518 | caret display. Usually the text cursor is displayed for half the cursor | - |
3519 | flash time, then hidden for the same amount of time, but this may vary. | - |
3520 | | - |
3521 | The default value on X11 is 1000 milliseconds. On Windows, the | - |
3522 | \uicontrol{Control Panel} value is used and setting this property sets the cursor | - |
3523 | flash time for all applications. | - |
3524 | | - |
3525 | We recommend that widgets do not cache this value as it may change at any | - |
3526 | time if the user changes the global desktop settings. | - |
3527 | */ | - |
3528 | void QApplication::setCursorFlashTime(int msecs) | - |
3529 | { | - |
3530 | Q_UNUSED(msecs); executed (the execution status of this line is deduced): (void)msecs;; | - |
3531 | } executed: } Execution Count:1 | 1 |
3532 | | - |
3533 | int QApplication::cursorFlashTime() | - |
3534 | { | - |
3535 | return qApp->styleHints()->cursorFlashTime(); executed: return (static_cast<QApplication *>(QCoreApplication::instance()))->styleHints()->cursorFlashTime(); Execution Count:4198 | 4198 |
3536 | } | - |
3537 | | - |
3538 | /*! | - |
3539 | \property QApplication::doubleClickInterval | - |
3540 | \brief the time limit in milliseconds that distinguishes a double click | - |
3541 | from two consecutive mouse clicks | - |
3542 | | - |
3543 | The default value on X11 is 400 milliseconds. On Windows and Mac OS, the | - |
3544 | operating system's value is used. | - |
3545 | | - |
3546 | Setting the interval is not supported anymore in Qt 5. | - |
3547 | */ | - |
3548 | void QApplication::setDoubleClickInterval(int ms) | - |
3549 | { | - |
3550 | Q_UNUSED(ms); never executed (the execution status of this line is deduced): (void)ms;; | - |
3551 | } | 0 |
3552 | | - |
3553 | int QApplication::doubleClickInterval() | - |
3554 | { | - |
3555 | return qApp->styleHints()->mouseDoubleClickInterval(); executed: return (static_cast<QApplication *>(QCoreApplication::instance()))->styleHints()->mouseDoubleClickInterval(); Execution Count:717 | 717 |
3556 | } | - |
3557 | | - |
3558 | /*! | - |
3559 | \fn QApplication::keyboardInputDirection() | - |
3560 | \since 4.2 | - |
3561 | \deprecated | - |
3562 | | - |
3563 | Returns the current keyboard input direction. Replaced with QInputPanel::inputDirection() | - |
3564 | \sa QInputPanel::inputDirection() | - |
3565 | */ | - |
3566 | | - |
3567 | /*! | - |
3568 | \property QApplication::keyboardInputInterval | - |
3569 | \brief the time limit in milliseconds that distinguishes a key press | - |
3570 | from two consecutive key presses | - |
3571 | \since 4.2 | - |
3572 | | - |
3573 | The default value on X11 is 400 milliseconds. On Windows and Mac OS, the | - |
3574 | operating system's value is used. | - |
3575 | */ | - |
3576 | void QApplication::setKeyboardInputInterval(int ms) | - |
3577 | { | - |
3578 | Q_UNUSED(ms); never executed (the execution status of this line is deduced): (void)ms;; | - |
3579 | } | 0 |
3580 | | - |
3581 | int QApplication::keyboardInputInterval() | - |
3582 | { | - |
3583 | return qApp->styleHints()->keyboardInputInterval(); executed: return (static_cast<QApplication *>(QCoreApplication::instance()))->styleHints()->keyboardInputInterval(); Execution Count:19 | 19 |
3584 | } | - |
3585 | | - |
3586 | /*! | - |
3587 | \property QApplication::wheelScrollLines | - |
3588 | \brief the number of lines to scroll a widget, when the | - |
3589 | mouse wheel is rotated. | - |
3590 | | - |
3591 | If the value exceeds the widget's number of visible lines, the widget | - |
3592 | should interpret the scroll operation as a single \e{page up} or | - |
3593 | \e{page down}. If the widget is an \l{QAbstractItemView}{item view class}, | - |
3594 | then the result of scrolling one \e line depends on the setting of the | - |
3595 | widget's \l{QAbstractItemView::verticalScrollMode()}{scroll mode}. Scroll | - |
3596 | one \e line can mean \l{QAbstractItemView::ScrollPerItem}{scroll one item} | - |
3597 | or \l{QAbstractItemView::ScrollPerPixel}{scroll one pixel}. | - |
3598 | | - |
3599 | By default, this property has a value of 3. | - |
3600 | */ | - |
3601 | | - |
3602 | /*! | - |
3603 | \fn void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable) | - |
3604 | | - |
3605 | Enables the UI effect \a effect if \a enable is true, otherwise the effect | - |
3606 | will not be used. | - |
3607 | | - |
3608 | \note All effects are disabled on screens running at less than 16-bit color | - |
3609 | depth. | - |
3610 | | - |
3611 | \sa isEffectEnabled(), Qt::UIEffect, setDesktopSettingsAware() | - |
3612 | */ | - |
3613 | | - |
3614 | /*! | - |
3615 | \fn bool QApplication::isEffectEnabled(Qt::UIEffect effect) | - |
3616 | | - |
3617 | Returns true if \a effect is enabled; otherwise returns false. | - |
3618 | | - |
3619 | By default, Qt will try to use the desktop settings. To prevent this, call | - |
3620 | setDesktopSettingsAware(false). | - |
3621 | | - |
3622 | \note All effects are disabled on screens running at less than 16-bit color | - |
3623 | depth. | - |
3624 | | - |
3625 | \sa setEffectEnabled(), Qt::UIEffect | - |
3626 | */ | - |
3627 | | - |
3628 | /*! | - |
3629 | \fn void QApplication::beep() | - |
3630 | | - |
3631 | Sounds the bell, using the default volume and sound. The function is \e not | - |
3632 | available in Qt for Embedded Linux. | - |
3633 | */ | - |
3634 | | - |
3635 | /*! | - |
3636 | \macro qApp | - |
3637 | \relates QApplication | - |
3638 | | - |
3639 | A global pointer referring to the unique application object. It is | - |
3640 | equivalent to the pointer returned by the QCoreApplication::instance() | - |
3641 | function except that, in GUI applications, it is a pointer to a | - |
3642 | QApplication instance. | - |
3643 | | - |
3644 | Only one application object can be created. | - |
3645 | | - |
3646 | \sa QCoreApplication::instance() | - |
3647 | */ | - |
3648 | | - |
3649 | /*! | - |
3650 | \fn QLocale QApplication::keyboardInputLocale() | - |
3651 | \since 4.2 | - |
3652 | \obsolete | - |
3653 | | - |
3654 | Returns the current keyboard input locale. Replaced with QInputMethod::locale() | - |
3655 | */ | - |
3656 | | - |
3657 | bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event) | - |
3658 | { | - |
3659 | return QGuiApplication::sendSpontaneousEvent(receiver, event); executed: return QGuiApplication::sendSpontaneousEvent(receiver, event); Execution Count:180 | 180 |
3660 | } | - |
3661 | | - |
3662 | | - |
3663 | void QApplicationPrivate::giveFocusAccordingToFocusPolicy(QWidget *widget, | - |
3664 | Qt::FocusPolicy focusPolicy, | - |
3665 | Qt::FocusReason focusReason) | - |
3666 | { | - |
3667 | QWidget *focusWidget = widget; executed (the execution status of this line is deduced): QWidget *focusWidget = widget; | - |
3668 | while (focusWidget) { partially evaluated: focusWidget yes Evaluation Count:10487 | no Evaluation Count:0 |
| 0-10487 |
3669 | if (focusWidget->isEnabled() evaluated: focusWidget->isEnabled() yes Evaluation Count:10483 | yes Evaluation Count:4 |
| 4-10483 |
3670 | && QApplicationPrivate::shouldSetFocus(focusWidget, focusPolicy)) { evaluated: QApplicationPrivate::shouldSetFocus(focusWidget, focusPolicy) yes Evaluation Count:5062 | yes Evaluation Count:5421 |
| 5062-5421 |
3671 | focusWidget->setFocus(focusReason); executed (the execution status of this line is deduced): focusWidget->setFocus(focusReason); | - |
3672 | break; executed: break; Execution Count:5062 | 5062 |
3673 | } | - |
3674 | if (focusWidget->isWindow()) evaluated: focusWidget->isWindow() yes Evaluation Count:233 | yes Evaluation Count:5192 |
| 233-5192 |
3675 | break; executed: break; Execution Count:233 | 233 |
3676 | focusWidget = focusWidget->parentWidget(); executed (the execution status of this line is deduced): focusWidget = focusWidget->parentWidget(); | - |
3677 | } executed: } Execution Count:5192 | 5192 |
3678 | } executed: } Execution Count:5295 | 5295 |
3679 | | - |
3680 | bool QApplicationPrivate::shouldSetFocus(QWidget *w, Qt::FocusPolicy policy) | - |
3681 | { | - |
3682 | QWidget *f = w; executed (the execution status of this line is deduced): QWidget *f = w; | - |
3683 | while (f->d_func()->extra && f->d_func()->extra->focus_proxy) evaluated: f->d_func()->extra yes Evaluation Count:15441 | yes Evaluation Count:181 |
evaluated: f->d_func()->extra->focus_proxy yes Evaluation Count:5139 | yes Evaluation Count:10302 |
| 181-15441 |
3684 | f = f->d_func()->extra->focus_proxy; executed: f = f->d_func()->extra->focus_proxy; Execution Count:5139 | 5139 |
3685 | | - |
3686 | if ((w->focusPolicy() & policy) != policy) evaluated: (w->focusPolicy() & policy) != policy yes Evaluation Count:5421 | yes Evaluation Count:5062 |
| 5062-5421 |
3687 | return false; executed: return false; Execution Count:5421 | 5421 |
3688 | if (w != f && (f->focusPolicy() & policy) != policy) evaluated: w != f yes Evaluation Count:22 | yes Evaluation Count:5040 |
partially evaluated: (f->focusPolicy() & policy) != policy no Evaluation Count:0 | yes Evaluation Count:22 |
| 0-5040 |
3689 | return false; never executed: return false; | 0 |
3690 | return true; executed: return true; Execution Count:5062 | 5062 |
3691 | } | - |
3692 | | - |
3693 | void QApplicationPrivate::updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent) | - |
3694 | { | - |
3695 | for (int i = 0; i < touchEvent->touchPoints().count(); ++i) { evaluated: i < touchEvent->touchPoints().count() yes Evaluation Count:29 | yes Evaluation Count:29 |
| 29 |
3696 | QTouchEvent::TouchPoint &touchPoint = touchEvent->_touchPoints[i]; executed (the execution status of this line is deduced): QTouchEvent::TouchPoint &touchPoint = touchEvent->_touchPoints[i]; | - |
3697 | | - |
3698 | // preserve the sub-pixel resolution | - |
3699 | QRectF rect = touchPoint.screenRect(); executed (the execution status of this line is deduced): QRectF rect = touchPoint.screenRect(); | - |
3700 | const QPointF screenPos = rect.center(); executed (the execution status of this line is deduced): const QPointF screenPos = rect.center(); | - |
3701 | const QPointF delta = screenPos - screenPos.toPoint(); executed (the execution status of this line is deduced): const QPointF delta = screenPos - screenPos.toPoint(); | - |
3702 | | - |
3703 | rect.moveCenter(widget->mapFromGlobal(screenPos.toPoint()) + delta); executed (the execution status of this line is deduced): rect.moveCenter(widget->mapFromGlobal(screenPos.toPoint()) + delta); | - |
3704 | touchPoint.d->rect = rect; executed (the execution status of this line is deduced): touchPoint.d->rect = rect; | - |
3705 | touchPoint.d->startPos = widget->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta; executed (the execution status of this line is deduced): touchPoint.d->startPos = widget->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta; | - |
3706 | touchPoint.d->lastPos = widget->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta; executed (the execution status of this line is deduced): touchPoint.d->lastPos = widget->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta; | - |
3707 | } executed: } Execution Count:29 | 29 |
3708 | } executed: } Execution Count:29 | 29 |
3709 | | - |
3710 | void QApplicationPrivate::initializeMultitouch() | - |
3711 | { | - |
3712 | initializeMultitouch_sys(); executed (the execution status of this line is deduced): initializeMultitouch_sys(); | - |
3713 | } executed: } Execution Count:215 | 215 |
3714 | | - |
3715 | void QApplicationPrivate::cleanupMultitouch() | - |
3716 | { | - |
3717 | cleanupMultitouch_sys(); executed (the execution status of this line is deduced): cleanupMultitouch_sys(); | - |
3718 | } executed: } Execution Count:213 | 213 |
3719 | | - |
3720 | QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device, const QPointF &screenPos) | - |
3721 | { | - |
3722 | int closestTouchPointId = -1; executed (the execution status of this line is deduced): int closestTouchPointId = -1; | - |
3723 | QObject *closestTarget = 0; executed (the execution status of this line is deduced): QObject *closestTarget = 0; | - |
3724 | qreal closestDistance = qreal(0.); executed (the execution status of this line is deduced): qreal closestDistance = qreal(0.); | - |
3725 | QHash<ActiveTouchPointsKey, ActiveTouchPointsValue>::const_iterator it = activeTouchPoints.constBegin(), executed (the execution status of this line is deduced): QHash<ActiveTouchPointsKey, ActiveTouchPointsValue>::const_iterator it = activeTouchPoints.constBegin(), | - |
3726 | ite = activeTouchPoints.constEnd(); executed (the execution status of this line is deduced): ite = activeTouchPoints.constEnd(); | - |
3727 | while (it != ite) { evaluated: it != ite yes Evaluation Count:16 | yes Evaluation Count:15 |
| 15-16 |
3728 | if (it.key().device == device) { evaluated: it.key().device == device yes Evaluation Count:15 | yes Evaluation Count:1 |
| 1-15 |
3729 | const QTouchEvent::TouchPoint &touchPoint = it->touchPoint; executed (the execution status of this line is deduced): const QTouchEvent::TouchPoint &touchPoint = it->touchPoint; | - |
3730 | qreal dx = screenPos.x() - touchPoint.screenPos().x(); executed (the execution status of this line is deduced): qreal dx = screenPos.x() - touchPoint.screenPos().x(); | - |
3731 | qreal dy = screenPos.y() - touchPoint.screenPos().y(); executed (the execution status of this line is deduced): qreal dy = screenPos.y() - touchPoint.screenPos().y(); | - |
3732 | qreal distance = dx * dx + dy * dy; executed (the execution status of this line is deduced): qreal distance = dx * dx + dy * dy; | - |
3733 | if (closestTouchPointId == -1 || distance < closestDistance) { partially evaluated: closestTouchPointId == -1 yes Evaluation Count:15 | no Evaluation Count:0 |
never evaluated: distance < closestDistance | 0-15 |
3734 | closestTouchPointId = touchPoint.id(); executed (the execution status of this line is deduced): closestTouchPointId = touchPoint.id(); | - |
3735 | closestDistance = distance; executed (the execution status of this line is deduced): closestDistance = distance; | - |
3736 | closestTarget = it.value().target.data(); executed (the execution status of this line is deduced): closestTarget = it.value().target.data(); | - |
3737 | } executed: } Execution Count:15 | 15 |
3738 | } executed: } Execution Count:15 | 15 |
3739 | ++it; executed (the execution status of this line is deduced): ++it; | - |
3740 | } executed: } Execution Count:16 | 16 |
3741 | return static_cast<QWidget *>(closestTarget); executed: return static_cast<QWidget *>(closestTarget); Execution Count:15 | 15 |
3742 | } | - |
3743 | | - |
3744 | class WidgetAttributeSaver | - |
3745 | { | - |
3746 | public: | - |
3747 | explicit WidgetAttributeSaver(QWidget *widget, Qt::WidgetAttribute attribute, bool forcedValue) | - |
3748 | : m_widget(widget), | - |
3749 | m_attribute(attribute), | - |
3750 | m_savedValue(widget->testAttribute(attribute)) | - |
3751 | { | - |
3752 | widget->setAttribute(attribute, forcedValue); executed (the execution status of this line is deduced): widget->setAttribute(attribute, forcedValue); | - |
3753 | } executed: } Execution Count:20 | 20 |
3754 | | - |
3755 | ~WidgetAttributeSaver() | - |
3756 | { | - |
3757 | m_widget->setAttribute(m_attribute, m_savedValue); executed (the execution status of this line is deduced): m_widget->setAttribute(m_attribute, m_savedValue); | - |
3758 | } executed: } Execution Count:20 | 20 |
3759 | | - |
3760 | private: | - |
3761 | QWidget * const m_widget; | - |
3762 | const Qt::WidgetAttribute m_attribute; | - |
3763 | const bool m_savedValue; | - |
3764 | }; | - |
3765 | | - |
3766 | bool QApplicationPrivate::translateTouchToMouse(QWidget *widget, QTouchEvent *event) | - |
3767 | { | - |
3768 | Q_Q(QApplication); executed (the execution status of this line is deduced): QApplication * const q = q_func(); | - |
3769 | | - |
3770 | // Check if the platform wants synthesized mouse events. | - |
3771 | if (!QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::SynthesizeMouseFromTouchEvents).toBool()) partially evaluated: !QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::SynthesizeMouseFromTouchEvents).toBool() no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
3772 | return false; never executed: return false; | 0 |
3773 | | - |
3774 | Q_FOREACH (const QTouchEvent::TouchPoint &p, event->touchPoints()) { executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(event->touchPoints())> _container_(event->touchPoints()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QTouchEvent::TouchPoint &p = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
3775 | const QEvent::Type eventType = (p.state() & Qt::TouchPointPressed) ? QEvent::MouseButtonPress evaluated: (p.state() & Qt::TouchPointPressed) yes Evaluation Count:16 | yes Evaluation Count:4 |
| 4-16 |
3776 | : (p.state() & Qt::TouchPointReleased) ? QEvent::MouseButtonRelease executed (the execution status of this line is deduced): : (p.state() & Qt::TouchPointReleased) ? QEvent::MouseButtonRelease | - |
3777 | : (p.state() & Qt::TouchPointMoved) ? QEvent::MouseMove executed (the execution status of this line is deduced): : (p.state() & Qt::TouchPointMoved) ? QEvent::MouseMove | - |
3778 | : QEvent::None; executed (the execution status of this line is deduced): : QEvent::None; | - |
3779 | | - |
3780 | if (eventType == QEvent::None) partially evaluated: eventType == QEvent::None no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
3781 | continue; never executed: continue; | 0 |
3782 | | - |
3783 | const QPoint pos = widget->mapFromGlobal(p.screenPos().toPoint()); executed (the execution status of this line is deduced): const QPoint pos = widget->mapFromGlobal(p.screenPos().toPoint()); | - |
3784 | | - |
3785 | QMouseEvent mouseEvent(eventType, pos, executed (the execution status of this line is deduced): QMouseEvent mouseEvent(eventType, pos, | - |
3786 | Qt::LeftButton, Qt::LeftButton, executed (the execution status of this line is deduced): Qt::LeftButton, Qt::LeftButton, | - |
3787 | event->modifiers()); executed (the execution status of this line is deduced): event->modifiers()); | - |
3788 | mouseEvent.setAccepted(true); executed (the execution status of this line is deduced): mouseEvent.setAccepted(true); | - |
3789 | mouseEvent.setTimestamp(event->timestamp()); executed (the execution status of this line is deduced): mouseEvent.setTimestamp(event->timestamp()); | - |
3790 | | - |
3791 | // Make sure our synthesized mouse event doesn't propagate | - |
3792 | // we want to control the propagation ourself to get a chance to | - |
3793 | // deliver a proper touch event higher up in the hierarchy if that | - |
3794 | // widget doesn't pick up the mouse event either. | - |
3795 | WidgetAttributeSaver saver(widget, Qt::WA_NoMousePropagation, true); executed (the execution status of this line is deduced): WidgetAttributeSaver saver(widget, Qt::WA_NoMousePropagation, true); | - |
3796 | | - |
3797 | // Note it has to be a spontaneous event if we want the focus management | - |
3798 | // and input method support to behave properly. Quite some of the code | - |
3799 | // related to those aspect check for the spontaneous flag. | - |
3800 | const bool res = q->sendSpontaneousEvent(widget, &mouseEvent); executed (the execution status of this line is deduced): const bool res = q->sendSpontaneousEvent(widget, &mouseEvent); | - |
3801 | event->setAccepted(mouseEvent.isAccepted()); executed (the execution status of this line is deduced): event->setAccepted(mouseEvent.isAccepted()); | - |
3802 | | - |
3803 | if (mouseEvent.isAccepted()) evaluated: mouseEvent.isAccepted() yes Evaluation Count:8 | yes Evaluation Count:12 |
| 8-12 |
3804 | return res; executed: return res; Execution Count:8 | 8 |
3805 | } executed: } Execution Count:12 | 12 |
3806 | | - |
3807 | return false; executed: return false; Execution Count:12 | 12 |
3808 | } | - |
3809 | | - |
3810 | void QApplicationPrivate::translateRawTouchEvent(QWidget *window, | - |
3811 | QTouchDevice *device, | - |
3812 | const QList<QTouchEvent::TouchPoint> &touchPoints, | - |
3813 | ulong timestamp) | - |
3814 | { | - |
3815 | QApplicationPrivate *d = self; executed (the execution status of this line is deduced): QApplicationPrivate *d = self; | - |
3816 | typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints; executed (the execution status of this line is deduced): typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints; | - |
3817 | QHash<QWidget *, StatesAndTouchPoints> widgetsNeedingEvents; executed (the execution status of this line is deduced): QHash<QWidget *, StatesAndTouchPoints> widgetsNeedingEvents; | - |
3818 | | - |
3819 | for (int i = 0; i < touchPoints.count(); ++i) { evaluated: i < touchPoints.count() yes Evaluation Count:29 | yes Evaluation Count:29 |
| 29 |
3820 | QTouchEvent::TouchPoint touchPoint = touchPoints.at(i); executed (the execution status of this line is deduced): QTouchEvent::TouchPoint touchPoint = touchPoints.at(i); | - |
3821 | // explicitly detach from the original touch point that we got, so even | - |
3822 | // if the touchpoint structs are reused, we will make a copy that we'll | - |
3823 | // deliver to the user (which might want to store the struct for later use). | - |
3824 | touchPoint.d = touchPoint.d->detach(); executed (the execution status of this line is deduced): touchPoint.d = touchPoint.d->detach(); | - |
3825 | | - |
3826 | // update state | - |
3827 | QPointer<QObject> target; executed (the execution status of this line is deduced): QPointer<QObject> target; | - |
3828 | ActiveTouchPointsKey touchInfoKey(device, touchPoint.id()); executed (the execution status of this line is deduced): ActiveTouchPointsKey touchInfoKey(device, touchPoint.id()); | - |
3829 | ActiveTouchPointsValue &touchInfo = d->activeTouchPoints[touchInfoKey]; executed (the execution status of this line is deduced): ActiveTouchPointsValue &touchInfo = d->activeTouchPoints[touchInfoKey]; | - |
3830 | if (touchPoint.state() == Qt::TouchPointPressed) { evaluated: touchPoint.state() == Qt::TouchPointPressed yes Evaluation Count:15 | yes Evaluation Count:14 |
| 14-15 |
3831 | if (device->type() == QTouchDevice::TouchPad) { partially evaluated: device->type() == QTouchDevice::TouchPad no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
3832 | // on touch-pads, send all touch points to the same widget | - |
3833 | target = d->activeTouchPoints.isEmpty() never evaluated: d->activeTouchPoints.isEmpty() | 0 |
3834 | ? QPointer<QObject>() never executed (the execution status of this line is deduced): ? QPointer<QObject>() | - |
3835 | : d->activeTouchPoints.constBegin().value().target; never executed (the execution status of this line is deduced): : d->activeTouchPoints.constBegin().value().target; | - |
3836 | } | 0 |
3837 | | - |
3838 | if (!target) { partially evaluated: !target yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
3839 | // determine which widget this event will go to | - |
3840 | if (!window) partially evaluated: !window no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
3841 | window = QApplication::topLevelAt(touchPoint.screenPos().toPoint()); never executed: window = QApplication::topLevelAt(touchPoint.screenPos().toPoint()); | 0 |
3842 | if (!window) partially evaluated: !window no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
3843 | continue; never executed: continue; | 0 |
3844 | target = window->childAt(window->mapFromGlobal(touchPoint.screenPos().toPoint())); executed (the execution status of this line is deduced): target = window->childAt(window->mapFromGlobal(touchPoint.screenPos().toPoint())); | - |
3845 | if (!target) evaluated: !target yes Evaluation Count:6 | yes Evaluation Count:9 |
| 6-9 |
3846 | target = window; executed: target = window; Execution Count:6 | 6 |
3847 | } executed: } Execution Count:15 | 15 |
3848 | | - |
3849 | if (device->type() == QTouchDevice::TouchScreen) { partially evaluated: device->type() == QTouchDevice::TouchScreen yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
3850 | QWidget *closestWidget = d->findClosestTouchPointTarget(device, touchPoint.screenPos()); executed (the execution status of this line is deduced): QWidget *closestWidget = d->findClosestTouchPointTarget(device, touchPoint.screenPos()); | - |
3851 | QWidget *widget = static_cast<QWidget *>(target.data()); executed (the execution status of this line is deduced): QWidget *widget = static_cast<QWidget *>(target.data()); | - |
3852 | if (closestWidget partially evaluated: closestWidget no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
3853 | && (widget->isAncestorOf(closestWidget) || closestWidget->isAncestorOf(widget))) { never evaluated: widget->isAncestorOf(closestWidget) never evaluated: closestWidget->isAncestorOf(widget) | 0 |
3854 | target = closestWidget; never executed (the execution status of this line is deduced): target = closestWidget; | - |
3855 | } | 0 |
3856 | } executed: } Execution Count:15 | 15 |
3857 | | - |
3858 | touchInfo.target = target; executed (the execution status of this line is deduced): touchInfo.target = target; | - |
3859 | } else { executed: } Execution Count:15 | 15 |
3860 | target = touchInfo.target; executed (the execution status of this line is deduced): target = touchInfo.target; | - |
3861 | if (!target) partially evaluated: !target no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
3862 | continue; never executed: continue; | 0 |
3863 | } executed: } Execution Count:14 | 14 |
3864 | Q_ASSERT(target.data() != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
3865 | | - |
3866 | StatesAndTouchPoints &maskAndPoints = widgetsNeedingEvents[static_cast<QWidget *>(target.data())]; executed (the execution status of this line is deduced): StatesAndTouchPoints &maskAndPoints = widgetsNeedingEvents[static_cast<QWidget *>(target.data())]; | - |
3867 | maskAndPoints.first |= touchPoint.state(); executed (the execution status of this line is deduced): maskAndPoints.first |= touchPoint.state(); | - |
3868 | maskAndPoints.second.append(touchPoint); executed (the execution status of this line is deduced): maskAndPoints.second.append(touchPoint); | - |
3869 | } executed: } Execution Count:29 | 29 |
3870 | | - |
3871 | if (widgetsNeedingEvents.isEmpty()) partially evaluated: widgetsNeedingEvents.isEmpty() no Evaluation Count:0 | yes Evaluation Count:29 |
| 0-29 |
3872 | return; | 0 |
3873 | | - |
3874 | QHash<QWidget *, StatesAndTouchPoints>::ConstIterator it = widgetsNeedingEvents.constBegin(); executed (the execution status of this line is deduced): QHash<QWidget *, StatesAndTouchPoints>::ConstIterator it = widgetsNeedingEvents.constBegin(); | - |
3875 | const QHash<QWidget *, StatesAndTouchPoints>::ConstIterator end = widgetsNeedingEvents.constEnd(); executed (the execution status of this line is deduced): const QHash<QWidget *, StatesAndTouchPoints>::ConstIterator end = widgetsNeedingEvents.constEnd(); | - |
3876 | for (; it != end; ++it) { evaluated: it != end yes Evaluation Count:29 | yes Evaluation Count:29 |
| 29 |
3877 | QWidget *widget = it.key(); executed (the execution status of this line is deduced): QWidget *widget = it.key(); | - |
3878 | if (!QApplicationPrivate::tryModalHelper(widget, 0)) partially evaluated: !QApplicationPrivate::tryModalHelper(widget, 0) no Evaluation Count:0 | yes Evaluation Count:29 |
| 0-29 |
3879 | continue; never executed: continue; | 0 |
3880 | | - |
3881 | QEvent::Type eventType; executed (the execution status of this line is deduced): QEvent::Type eventType; | - |
3882 | switch (it.value().first) { | - |
3883 | case Qt::TouchPointPressed: | - |
3884 | eventType = QEvent::TouchBegin; executed (the execution status of this line is deduced): eventType = QEvent::TouchBegin; | - |
3885 | break; executed: break; Execution Count:15 | 15 |
3886 | case Qt::TouchPointReleased: | - |
3887 | eventType = QEvent::TouchEnd; executed (the execution status of this line is deduced): eventType = QEvent::TouchEnd; | - |
3888 | break; executed: break; Execution Count:12 | 12 |
3889 | case Qt::TouchPointStationary: | - |
3890 | // don't send the event if nothing changed | - |
3891 | continue; never executed: continue; | 0 |
3892 | default: | - |
3893 | eventType = QEvent::TouchUpdate; executed (the execution status of this line is deduced): eventType = QEvent::TouchUpdate; | - |
3894 | break; executed: break; Execution Count:2 | 2 |
3895 | } | - |
3896 | | - |
3897 | QTouchEvent touchEvent(eventType, executed (the execution status of this line is deduced): QTouchEvent touchEvent(eventType, | - |
3898 | device, executed (the execution status of this line is deduced): device, | - |
3899 | QApplication::keyboardModifiers(), executed (the execution status of this line is deduced): QApplication::keyboardModifiers(), | - |
3900 | it.value().first, executed (the execution status of this line is deduced): it.value().first, | - |
3901 | it.value().second); executed (the execution status of this line is deduced): it.value().second); | - |
3902 | updateTouchPointsForWidget(widget, &touchEvent); executed (the execution status of this line is deduced): updateTouchPointsForWidget(widget, &touchEvent); | - |
3903 | touchEvent.setTimestamp(timestamp); executed (the execution status of this line is deduced): touchEvent.setTimestamp(timestamp); | - |
3904 | touchEvent.setWindow(window->windowHandle()); executed (the execution status of this line is deduced): touchEvent.setWindow(window->windowHandle()); | - |
3905 | touchEvent.setTarget(widget); executed (the execution status of this line is deduced): touchEvent.setTarget(widget); | - |
3906 | | - |
3907 | switch (touchEvent.type()) { | - |
3908 | case QEvent::TouchBegin: | - |
3909 | { | - |
3910 | // if the TouchBegin handler recurses, we assume that means the event | - |
3911 | // has been implicitly accepted and continue to send touch events | - |
3912 | widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent); executed (the execution status of this line is deduced): widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent); | - |
3913 | (void ) QApplication::sendSpontaneousEvent(widget, &touchEvent); executed (the execution status of this line is deduced): (void ) QApplication::sendSpontaneousEvent(widget, &touchEvent); | - |
3914 | break; executed: break; Execution Count:15 | 15 |
3915 | } | - |
3916 | default: | - |
3917 | if (widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent)) { evaluated: widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent) yes Evaluation Count:9 | yes Evaluation Count:5 |
| 5-9 |
3918 | if (touchEvent.type() == QEvent::TouchEnd) evaluated: touchEvent.type() == QEvent::TouchEnd yes Evaluation Count:7 | yes Evaluation Count:2 |
| 2-7 |
3919 | widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, false); executed: widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, false); Execution Count:7 | 7 |
3920 | (void) QApplication::sendSpontaneousEvent(widget, &touchEvent); executed (the execution status of this line is deduced): (void) QApplication::sendSpontaneousEvent(widget, &touchEvent); | - |
3921 | } executed: } Execution Count:9 | 9 |
3922 | break; executed: break; Execution Count:14 | 14 |
3923 | } | - |
3924 | } executed: } Execution Count:29 | 29 |
3925 | } executed: } Execution Count:29 | 29 |
3926 | | - |
3927 | void QApplicationPrivate::translateTouchCancel(QTouchDevice *device, ulong timestamp) | - |
3928 | { | - |
3929 | QTouchEvent touchEvent(QEvent::TouchCancel, device, QApplication::keyboardModifiers()); never executed (the execution status of this line is deduced): QTouchEvent touchEvent(QEvent::TouchCancel, device, QApplication::keyboardModifiers()); | - |
3930 | touchEvent.setTimestamp(timestamp); never executed (the execution status of this line is deduced): touchEvent.setTimestamp(timestamp); | - |
3931 | QHash<ActiveTouchPointsKey, ActiveTouchPointsValue>::const_iterator it never executed (the execution status of this line is deduced): QHash<ActiveTouchPointsKey, ActiveTouchPointsValue>::const_iterator it | - |
3932 | = self->activeTouchPoints.constBegin(), ite = self->activeTouchPoints.constEnd(); never executed (the execution status of this line is deduced): = self->activeTouchPoints.constBegin(), ite = self->activeTouchPoints.constEnd(); | - |
3933 | QSet<QWidget *> widgetsNeedingCancel; never executed (the execution status of this line is deduced): QSet<QWidget *> widgetsNeedingCancel; | - |
3934 | while (it != ite) { never evaluated: it != ite | 0 |
3935 | QWidget *widget = static_cast<QWidget *>(it->target.data()); never executed (the execution status of this line is deduced): QWidget *widget = static_cast<QWidget *>(it->target.data()); | - |
3936 | if (widget) | 0 |
3937 | widgetsNeedingCancel.insert(widget); never executed: widgetsNeedingCancel.insert(widget); | 0 |
3938 | ++it; never executed (the execution status of this line is deduced): ++it; | - |
3939 | } | 0 |
3940 | for (QSet<QWidget *>::const_iterator widIt = widgetsNeedingCancel.constBegin(), never executed (the execution status of this line is deduced): for (QSet<QWidget *>::const_iterator widIt = widgetsNeedingCancel.constBegin(), | - |
3941 | widItEnd = widgetsNeedingCancel.constEnd(); widIt != widItEnd; ++widIt) { never evaluated: widIt != widItEnd | 0 |
3942 | QWidget *widget = *widIt; never executed (the execution status of this line is deduced): QWidget *widget = *widIt; | - |
3943 | touchEvent.setWindow(widget->windowHandle()); never executed (the execution status of this line is deduced): touchEvent.setWindow(widget->windowHandle()); | - |
3944 | touchEvent.setTarget(widget); never executed (the execution status of this line is deduced): touchEvent.setTarget(widget); | - |
3945 | QApplication::sendSpontaneousEvent(widget, &touchEvent); never executed (the execution status of this line is deduced): QApplication::sendSpontaneousEvent(widget, &touchEvent); | - |
3946 | } | 0 |
3947 | } | 0 |
3948 | | - |
3949 | void QApplicationPrivate::notifyThemeChanged() | - |
3950 | { | - |
3951 | QGuiApplicationPrivate::notifyThemeChanged(); never executed (the execution status of this line is deduced): QGuiApplicationPrivate::notifyThemeChanged(); | - |
3952 | clearSystemPalette(); never executed (the execution status of this line is deduced): clearSystemPalette(); | - |
3953 | initSystemPalette(); never executed (the execution status of this line is deduced): initSystemPalette(); | - |
3954 | } | 0 |
3955 | | - |
3956 | #ifndef QT_NO_DRAGANDDROP | - |
3957 | void QApplicationPrivate::notifyDragStarted(const QDrag *drag) | - |
3958 | { | - |
3959 | // Prevent pickMouseReceiver() from using the widget where the drag was started after a drag operation. | - |
3960 | QGuiApplicationPrivate::notifyDragStarted(drag); never executed (the execution status of this line is deduced): QGuiApplicationPrivate::notifyDragStarted(drag); | - |
3961 | qt_button_down = 0; never executed (the execution status of this line is deduced): qt_button_down = 0; | - |
3962 | } | 0 |
3963 | #endif // QT_NO_DRAGANDDROP | - |
3964 | | - |
3965 | #ifndef QT_NO_GESTURES | - |
3966 | QGestureManager* QGestureManager::instance() | - |
3967 | { | - |
3968 | QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); executed (the execution status of this line is deduced): QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); | - |
3969 | if (!qAppPriv) partially evaluated: !qAppPriv no Evaluation Count:0 | yes Evaluation Count:11672 |
| 0-11672 |
3970 | return 0; never executed: return 0; | 0 |
3971 | if (!qAppPriv->gestureManager) evaluated: !qAppPriv->gestureManager yes Evaluation Count:56 | yes Evaluation Count:11616 |
| 56-11616 |
3972 | qAppPriv->gestureManager = new QGestureManager(qApp); executed: qAppPriv->gestureManager = new QGestureManager((static_cast<QApplication *>(QCoreApplication::instance()))); Execution Count:56 | 56 |
3973 | return qAppPriv->gestureManager; executed: return qAppPriv->gestureManager; Execution Count:11672 | 11672 |
3974 | } | - |
3975 | #endif // QT_NO_GESTURES | - |
3976 | | - |
3977 | QPixmap QApplicationPrivate::applyQIconStyleHelper(QIcon::Mode mode, const QPixmap& base) const | - |
3978 | { | - |
3979 | QStyleOption opt(0); executed (the execution status of this line is deduced): QStyleOption opt(0); | - |
3980 | opt.palette = QGuiApplication::palette(); executed (the execution status of this line is deduced): opt.palette = QGuiApplication::palette(); | - |
3981 | return QApplication::style()->generatedIconPixmap(mode, base, &opt); executed: return QApplication::style()->generatedIconPixmap(mode, base, &opt); Execution Count:48 | 48 |
3982 | } | - |
3983 | | - |
3984 | QT_END_NAMESPACE | - |
3985 | | - |
3986 | #include "moc_qapplication.cpp" | - |
3987 | | - |
| | |