qapplication.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/kernel/qapplication.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtWidgets module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qplatformdefs.h"-
41#include "qabstracteventdispatcher.h"-
42#include "qapplication.h"-
43#include "qclipboard.h"-
44#include "qcursor.h"-
45#include "qdesktopwidget.h"-
46#include "qdir.h"-
47#include "qevent.h"-
48#include "qfile.h"-
49#include "qfileinfo.h"-
50#include "qgraphicsscene.h"-
51#include "qhash.h"-
52#include "qset.h"-
53#include "qlayout.h"-
54#include "qstyle.h"-
55#include "qstyleoption.h"-
56#include "qstylefactory.h"-
57#include "qtextcodec.h"-
58#include "qtooltip.h"-
59#include "qtranslator.h"-
60#include "qvariant.h"-
61#include "qwidget.h"-
62#include "private/qdnd_p.h"-
63#include "private/qguiapplication_p.h"-
64#include "qcolormap.h"-
65#include "qdebug.h"-
66#include "private/qstylesheetstyle_p.h"-
67#include "private/qstyle_p.h"-
68#include "qmessagebox.h"-
69#include "qwidgetwindow_p.h"-
70#include <QtWidgets/qgraphicsproxywidget.h>-
71#include <QtGui/qstylehints.h>-
72#include <QtGui/qinputmethod.h>-
73#include <QtGui/private/qwindow_p.h>-
74#include <QtGui/qtouchdevice.h>-
75#include <qpa/qplatformtheme.h>-
76#ifndef QT_NO_WHATSTHIS-
77#include <QtWidgets/QWhatsThis>-
78#endif-
79-
80#include "private/qkeymapper_p.h"-
81#include "private/qaccessiblewidgetfactory_p.h"-
82-
83#include <qthread.h>-
84#include <private/qthread_p.h>-
85-
86#include <private/qfont_p.h>-
87-
88#include <stdlib.h>-
89-
90#include "qapplication_p.h"-
91#include "private/qevent_p.h"-
92#include "qwidget_p.h"-
93-
94#include "qgesture.h"-
95#include "private/qgesturemanager_p.h"-
96#include <qpa/qplatformfontdatabase.h>-
97-
98#ifdef Q_OS_WIN-
99#include <QtCore/qt_windows.h> // for qt_win_display_dc()-
100#endif-
101-
102#include "qdatetime.h"-
103-
104#ifdef Q_OS_WINCE-
105extern bool qt_wince_is_smartphone(); //qguifunctions_wince.cpp-
106extern bool qt_wince_is_mobile(); //qguifunctions_wince.cpp-
107extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp-
108#endif-
109-
110#include <qpa/qplatformwindow.h>-
111-
112//#define ALIEN_DEBUG-
113-
114static void initResources()-
115{-
116#if defined(Q_OS_WINCE)-
117 Q_INIT_RESOURCE(qstyle_wince);-
118#else-
119 Q_INIT_RESOURCE(qstyle);-
120#endif-
121 Q_INIT_RESOURCE(qmessagebox);-
122-
123}
never executed: end of block
0
124-
125QT_BEGIN_NAMESPACE-
126-
127// Helper macro for static functions to check on the existence of the application class.-
128#define CHECK_QAPP_INSTANCE(...) \-
129 if (Q_LIKELY(QCoreApplication::instance())) { \-
130 } else { \-
131 qWarning("Must construct a QApplication first."); \-
132 return __VA_ARGS__; \-
133 }-
134-
135Q_CORE_EXPORT void qt_call_post_routines();-
136-
137QApplicationPrivate *QApplicationPrivate::self = 0;-
138-
139static void initSystemPalette()-
140{-
141 if (!QApplicationPrivate::sys_pal) {
!QApplicationPrivate::sys_palDescription
TRUEnever evaluated
FALSEnever evaluated
0
142 QPalette defaultPlatte;-
143 if (QApplicationPrivate::app_style)
QApplicationPrivate::app_styleDescription
TRUEnever evaluated
FALSEnever evaluated
0
144 defaultPlatte = QApplicationPrivate::app_style->standardPalette();
never executed: defaultPlatte = QApplicationPrivate::app_style->standardPalette();
0
145 if (const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette()) {
const QPalette...e()->palette()Description
TRUEnever evaluated
FALSEnever evaluated
0
146 QApplicationPrivate::setSystemPalette(themePalette->resolve(defaultPlatte));-
147 QApplicationPrivate::initializeWidgetPaletteHash();-
148 } else {
never executed: end of block
0
149 QApplicationPrivate::setSystemPalette(defaultPlatte);-
150 }
never executed: end of block
0
151 }-
152}
never executed: end of block
0
153-
154static void clearSystemPalette()-
155{-
156 delete QApplicationPrivate::sys_pal;-
157 QApplicationPrivate::sys_pal = 0;-
158}
never executed: end of block
0
159-
160static QByteArray get_style_class_name()-
161{-
162 QScopedPointer<QStyle> s(QStyleFactory::create(QApplicationPrivate::desktopStyleKey()));-
163 if (!s.isNull())
!s.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
164 return s->metaObject()->className();
never executed: return s->metaObject()->className();
0
165 return QByteArray();
never executed: return QByteArray();
0
166}-
167-
168static QByteArray nativeStyleClassName()-
169{-
170 static QByteArray name = get_style_class_name();-
171 return name;
never executed: return name;
0
172}-
173-
174#ifdef Q_OS_WINCE-
175int QApplicationPrivate::autoMaximizeThreshold = -1;-
176bool QApplicationPrivate::autoSipEnabled = false;-
177#else-
178bool QApplicationPrivate::autoSipEnabled = true;-
179#endif-
180-
181QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags)-
182 : QApplicationPrivateBase(argc, argv, flags)-
183{-
184 application_type = QApplicationPrivate::Gui;-
185-
186#ifndef QT_NO_GESTURES-
187 gestureManager = 0;-
188 gestureWidget = 0;-
189#endif // QT_NO_GESTURES-
190-
191 if (!self)
!selfDescription
TRUEnever evaluated
FALSEnever evaluated
0
192 self = this;
never executed: self = this;
0
193}
never executed: end of block
0
194-
195QApplicationPrivate::~QApplicationPrivate()-
196{-
197 if (self == this)
self == thisDescription
TRUEnever evaluated
FALSEnever evaluated
0
198 self = 0;
never executed: self = 0;
0
199}
never executed: end of block
0
200-
201void QApplicationPrivate::createEventDispatcher()-
202{-
203 QGuiApplicationPrivate::createEventDispatcher();-
204}
never executed: end of block
0
205-
206/*!-
207 \class QApplication-
208 \brief The QApplication class manages the GUI application's control-
209 flow and main settings.-
210-
211 \inmodule QtWidgets-
212-
213 QApplication specializes QGuiApplication with some functionality needed-
214 for QWidget-based applications. It handles widget specific initialization,-
215 finalization.-
216-
217 For any GUI application using Qt, there is precisely \b one QApplication-
218 object, no matter whether the application has 0, 1, 2 or more windows at-
219 any given time. For non-QWidget based Qt applications, use QGuiApplication instead,-
220 as it does not depend on the \l QtWidgets library.-
221-
222 Some GUI applications provide a special batch mode ie. provide command line-
223 arguments for executing tasks without manual intervention. In such non-GUI-
224 mode, it is often sufficient to instantiate a plain QCoreApplication to-
225 avoid unnecessarily initializing resources needed for a graphical user-
226 interface. The following example shows how to dynamically create an-
227 appropriate type of application instance:-
228-
229 \snippet code/src_gui_kernel_qapplication.cpp 0-
230-
231 The QApplication object is accessible through the instance() function that-
232 returns a pointer equivalent to the global qApp pointer.-
233-
234 QApplication's main areas of responsibility are:-
235 \list-
236 \li It initializes the application with the user's desktop settings-
237 such as palette(), font() and doubleClickInterval(). It keeps-
238 track of these properties in case the user changes the desktop-
239 globally, for example through some kind of control panel.-
240-
241 \li It performs event handling, meaning that it receives events-
242 from the underlying window system and dispatches them to the-
243 relevant widgets. By using sendEvent() and postEvent() you can-
244 send your own events to widgets.-
245-
246 \li It parses common command line arguments and sets its internal-
247 state accordingly. See the \l{QApplication::QApplication()}-
248 {constructor documentation} below for more details.-
249-
250 \li It defines the application's look and feel, which is-
251 encapsulated in a QStyle object. This can be changed at runtime-
252 with setStyle().-
253-
254 \li It specifies how the application is to allocate colors. See-
255 setColorSpec() for details.-
256-
257 \li It provides localization of strings that are visible to the-
258 user via translate().-
259-
260 \li It provides some magical objects like the desktop() and the-
261 clipboard().-
262-
263 \li It knows about the application's windows. You can ask which-
264 widget is at a certain position using widgetAt(), get a list of-
265 topLevelWidgets() and closeAllWindows(), etc.-
266-
267 \li It manages the application's mouse cursor handling, see-
268 setOverrideCursor()-
269 \endlist-
270-
271 Since the QApplication object does so much initialization, it \e{must} be-
272 created before any other objects related to the user interface are created.-
273 QApplication also deals with common command line arguments. Hence, it is-
274 usually a good idea to create it \e before any interpretation or-
275 modification of \c argv is done in the application itself.-
276-
277 \table-
278 \header-
279 \li{2,1} Groups of functions-
280-
281 \row-
282 \li System settings-
283 \li desktopSettingsAware(),-
284 setDesktopSettingsAware(),-
285 cursorFlashTime(),-
286 setCursorFlashTime(),-
287 doubleClickInterval(),-
288 setDoubleClickInterval(),-
289 setKeyboardInputInterval(),-
290 wheelScrollLines(),-
291 setWheelScrollLines(),-
292 palette(),-
293 setPalette(),-
294 font(),-
295 setFont(),-
296 fontMetrics().-
297-
298 \row-
299 \li Event handling-
300 \li exec(),-
301 processEvents(),-
302 exit(),-
303 quit().-
304 sendEvent(),-
305 postEvent(),-
306 sendPostedEvents(),-
307 removePostedEvents(),-
308 hasPendingEvents(),-
309 notify().-
310-
311 \row-
312 \li GUI Styles-
313 \li style(),-
314 setStyle().-
315-
316 \row-
317 \li Color usage-
318 \li colorSpec(),-
319 setColorSpec().-
320-
321 \row-
322 \li Text handling-
323 \li installTranslator(),-
324 removeTranslator()-
325 translate().-
326-
327 \row-
328 \li Widgets-
329 \li allWidgets(),-
330 topLevelWidgets(),-
331 desktop(),-
332 activePopupWidget(),-
333 activeModalWidget(),-
334 clipboard(),-
335 focusWidget(),-
336 activeWindow(),-
337 widgetAt().-
338-
339 \row-
340 \li Advanced cursor handling-
341 \li overrideCursor(),-
342 setOverrideCursor(),-
343 restoreOverrideCursor().-
344-
345 \row-
346 \li Miscellaneous-
347 \li closeAllWindows(),-
348 startingUp(),-
349 closingDown().-
350 \endtable-
351-
352 \sa QCoreApplication, QAbstractEventDispatcher, QEventLoop, QSettings-
353*/-
354-
355/*!-
356 \enum QApplication::ColorSpec-
357-
358 \value NormalColor the default color allocation policy-
359 \value CustomColor the same as NormalColor for X11; allocates colors-
360 to a palette on demand under Windows-
361 \value ManyColor the right choice for applications that use thousands of-
362 colors-
363-
364 See setColorSpec() for full details.-
365*/-
366-
367/*!-
368 \fn QApplication::setGraphicsSystem(const QString &)-
369 \obsolete-
370-
371 This call has no effect.-
372-
373 Use the QPA framework instead.-
374*/-
375-
376/*!-
377 \fn QWidget *QApplication::topLevelAt(const QPoint &point)-
378-
379 Returns the top-level widget at the given \a point; returns 0 if-
380 there is no such widget.-
381*/-
382QWidget *QApplication::topLevelAt(const QPoint &pos)-
383{-
384 if (const QWindow *window = QGuiApplication::topLevelAt(pos)) {
const QWindow ...opLevelAt(pos)Description
TRUEnever evaluated
FALSEnever evaluated
0
385 if (const QWidgetWindow *widgetWindow = qobject_cast<const QWidgetWindow *>(window))
const QWidgetW...dow *>(window)Description
TRUEnever evaluated
FALSEnever evaluated
0
386 return widgetWindow->widget();
never executed: return widgetWindow->widget();
0
387 }
never executed: end of block
0
388 return 0;
never executed: return 0;
0
389}-
390-
391/*!-
392 \fn QWidget *QApplication::topLevelAt(int x, int y)-
393-
394 \overload-
395-
396 Returns the top-level widget at the point (\a{x}, \a{y}); returns-
397 0 if there is no such widget.-
398*/-
399-
400void qt_init(QApplicationPrivate *priv, int type-
401 );-
402void qt_init_tooltip_palette();-
403void qt_cleanup();-
404-
405QStyle *QApplicationPrivate::app_style = 0; // default application style-
406bool QApplicationPrivate::overrides_native_style = false; // whether native QApplication style is-
407 // overridden, i.e. not native-
408#ifndef QT_NO_STYLE_STYLESHEET-
409QString QApplicationPrivate::styleSheet; // default application stylesheet-
410#endif-
411QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0;-
412-
413int QApplicationPrivate::app_cspec = QApplication::NormalColor;-
414-
415QPalette *QApplicationPrivate::sys_pal = 0; // default system palette-
416QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer-
417-
418QFont *QApplicationPrivate::sys_font = 0; // default system font-
419QFont *QApplicationPrivate::set_font = 0; // default font set by programmer-
420-
421QWidget *QApplicationPrivate::main_widget = 0; // main application widget-
422QWidget *QApplicationPrivate::focus_widget = 0; // has keyboard input focus-
423QWidget *QApplicationPrivate::hidden_focus_widget = 0; // will get keyboard input focus after show()-
424QWidget *QApplicationPrivate::active_window = 0; // toplevel with keyboard focus-
425#ifndef QT_NO_WHEELEVENT-
426int QApplicationPrivate::wheel_scroll_lines; // number of lines to scroll-
427QPointer<QWidget> QApplicationPrivate::wheel_widget;-
428#endif-
429bool qt_in_tab_key_event = false;-
430int qt_antialiasing_threshold = -1;-
431QSize QApplicationPrivate::app_strut = QSize(0,0); // no default application strut-
432int QApplicationPrivate::enabledAnimations = QPlatformTheme::GeneralUiEffect;-
433bool QApplicationPrivate::widgetCount = false;-
434#ifdef QT_KEYPAD_NAVIGATION-
435Qt::NavigationMode QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadTabOrder;-
436QWidget *QApplicationPrivate::oldEditFocus = 0;-
437#endif-
438-
439inline bool QApplicationPrivate::isAlien(QWidget *widget)-
440{-
441 return widget && !widget->isWindow();
never executed: return widget && !widget->isWindow();
0
442}-
443-
444bool Q_WIDGETS_EXPORT qt_tab_all_widgets()-
445{-
446 return QGuiApplication::styleHints()->tabFocusBehavior() == Qt::TabFocusAllControls;
never executed: return QGuiApplication::styleHints()->tabFocusBehavior() == Qt::TabFocusAllControls;
0
447}-
448-
449// ######## move to QApplicationPrivate-
450// Default application palettes and fonts (per widget type)-
451Q_GLOBAL_STATIC(PaletteHash, app_palettes)
never executed: end of block
never executed: guard.store(QtGlobalStatic::Destroyed);
never executed: return &holder.value;
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
0
452PaletteHash *qt_app_palettes_hash()-
453{-
454 return app_palettes();
never executed: return app_palettes();
0
455}-
456-
457Q_GLOBAL_STATIC(FontHash, app_fonts)
never executed: end of block
never executed: guard.store(QtGlobalStatic::Destroyed);
never executed: return &holder.value;
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
0
458FontHash *qt_app_fonts_hash()-
459{-
460 return app_fonts();
never executed: return app_fonts();
0
461}-
462-
463QWidgetList *QApplicationPrivate::popupWidgets = 0; // has keyboard input focus-
464-
465QDesktopWidget *qt_desktopWidget = 0; // root window widgets-
466-
467/*!-
468 \internal-
469*/-
470void QApplicationPrivate::process_cmdline()-
471{-
472 if (styleOverride.isEmpty() && qEnvironmentVariableIsSet("QT_STYLE_OVERRIDE"))
styleOverride.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
qEnvironmentVa...YLE_OVERRIDE")Description
TRUEnever evaluated
FALSEnever evaluated
0
473 styleOverride = QString::fromLocal8Bit(qgetenv("QT_STYLE_OVERRIDE"));
never executed: styleOverride = QString::fromLocal8Bit(qgetenv("QT_STYLE_OVERRIDE"));
0
474-
475 if (!styleOverride.isEmpty()) {
!styleOverride.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
476 if (app_style) {
app_styleDescription
TRUEnever evaluated
FALSEnever evaluated
0
477 delete app_style;-
478 app_style = 0;-
479 }
never executed: end of block
0
480 }
never executed: end of block
0
481-
482 // process platform-indep command line-
483 if (!qt_is_gui_used || !argc)
!qt_is_gui_usedDescription
TRUEnever evaluated
FALSEnever evaluated
!argcDescription
TRUEnever evaluated
FALSEnever evaluated
0
484 return;
never executed: return;
0
485-
486 int i, j;-
487-
488 j = 1;-
489 for (i=1; i<argc; i++) { // if you add anything here, modify QCoreApplication::arguments()
i<argcDescription
TRUEnever evaluated
FALSEnever evaluated
0
490 if (!argv[i])
!argv[i]Description
TRUEnever evaluated
FALSEnever evaluated
0
491 continue;
never executed: continue;
0
492 if (*argv[i] != '-') {
*argv[i] != '-'Description
TRUEnever evaluated
FALSEnever evaluated
0
493 argv[j++] = argv[i];-
494 continue;
never executed: continue;
0
495 }-
496 const char *arg = argv[i];-
497 if (arg[1] == '-') // startsWith("--")
arg[1] == '-'Description
TRUEnever evaluated
FALSEnever evaluated
0
498 ++arg;
never executed: ++arg;
0
499 if (strcmp(arg, "-qdevel") == 0 || strcmp(arg, "-qdebug") == 0) {
strcmp(arg, "-qdevel") == 0Description
TRUEnever evaluated
FALSEnever evaluated
strcmp(arg, "-qdebug") == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
500 // obsolete argument-
501#ifndef QT_NO_STYLE_STYLESHEET-
502 } else if (strcmp(arg, "-stylesheet") == 0 && i < argc -1) {
never executed: end of block
strcmp(arg, "-...lesheet") == 0Description
TRUEnever evaluated
FALSEnever evaluated
i < argc -1Description
TRUEnever evaluated
FALSEnever evaluated
0
503 styleSheet = QLatin1String("file:///");-
504 styleSheet.append(QString::fromLocal8Bit(argv[++i]));-
505 } else if (strncmp(arg, "-stylesheet=", 12) == 0) {
never executed: end of block
strncmp(arg, "...et=", 12) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
506 styleSheet = QLatin1String("file:///");-
507 styleSheet.append(QString::fromLocal8Bit(arg + 12));-
508#endif-
509 } else if (qstrcmp(arg, "-widgetcount") == 0) {
never executed: end of block
qstrcmp(arg, "...etcount") == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
510 widgetCount = true;-
511 } else {
never executed: end of block
0
512 argv[j++] = argv[i];-
513 }
never executed: end of block
0
514 }-
515-
516 if(j < argc) {
j < argcDescription
TRUEnever evaluated
FALSEnever evaluated
0
517 argv[j] = 0;-
518 argc = j;-
519 }
never executed: end of block
0
520}
never executed: end of block
0
521-
522/*!-
523 Initializes the window system and constructs an application object with-
524 \a argc command line arguments in \a argv.-
525-
526 \warning The data referred to by \a argc and \a argv must stay valid for-
527 the entire lifetime of the QApplication object. In addition, \a argc must-
528 be greater than zero and \a argv must contain at least one valid character-
529 string.-
530-
531 The global \c qApp pointer refers to this application object. Only one-
532 application object should be created.-
533-
534 This application object must be constructed before any \l{QPaintDevice}-
535 {paint devices} (including widgets, pixmaps, bitmaps etc.).-
536-
537 \note \a argc and \a argv might be changed as Qt removes command line-
538 arguments that it recognizes.-
539-
540 All Qt programs automatically support the following command line options:-
541 \list-
542 \li -style= \e style, sets the application GUI style. Possible values-
543 depend on your system configuration. If you compiled Qt with-
544 additional styles or have additional styles as plugins these will-
545 be available to the \c -style command line option. You can also-
546 set the style for all Qt applications by setting the-
547 \c QT_STYLE_OVERRIDE environment variable.-
548 \li -style \e style, is the same as listed above.-
549 \li -stylesheet= \e stylesheet, sets the application \l styleSheet. The-
550 value must be a path to a file that contains the Style Sheet.-
551 \note Relative URLs in the Style Sheet file are relative to the-
552 Style Sheet file's path.-
553 \li -stylesheet \e stylesheet, is the same as listed above.-
554 \li -widgetcount, prints debug message at the end about number of-
555 widgets left undestroyed and maximum number of widgets existed at-
556 the same time-
557 \li -reverse, sets the application's layout direction to-
558 Qt::RightToLeft-
559 \li -qmljsdebugger=, activates the QML/JS debugger with a specified port.-
560 The value must be of format port:1234[,block], where block is optional-
561 and will make the application wait until a debugger connects to it.-
562 \endlist-
563-
564 \sa QCoreApplication::arguments()-
565*/-
566-
567#ifdef Q_QDOC-
568QApplication::QApplication(int &argc, char **argv)-
569#else-
570QApplication::QApplication(int &argc, char **argv, int _internal)-
571#endif-
572 : QGuiApplication(*new QApplicationPrivate(argc, argv, _internal))-
573{-
574 Q_D(QApplication);-
575 d->init();-
576}
never executed: end of block
0
577-
578/*!-
579 \internal-
580*/-
581void QApplicationPrivate::init()-
582{-
583 QGuiApplicationPrivate::init();-
584-
585 initResources();-
586-
587 qt_is_gui_used = (application_type != QApplicationPrivate::Tty);-
588 process_cmdline();-
589-
590 // Must be called before initialize()-
591 qt_init(this, application_type);-
592 initialize();-
593 eventDispatcher->startingUp();-
594-
595#ifdef QT_EVAL-
596 extern void qt_gui_eval_init(QCoreApplicationPrivate::Type);-
597 qt_gui_eval_init(application_type);-
598#endif-
599#ifndef QT_NO_ACCESSIBILITY-
600 // factory for accessible interfaces for widgets shipped with Qt-
601 QAccessible::installFactory(&qAccessibleFactory);-
602#endif-
603-
604}
never executed: end of block
0
605-
606void qt_init(QApplicationPrivate *priv, int type)-
607{-
608 Q_UNUSED(priv);-
609 Q_UNUSED(type);-
610-
611 QColormap::initialize();-
612-
613 qt_init_tooltip_palette();-
614-
615 QApplicationPrivate::initializeWidgetFontHash();-
616}
never executed: end of block
0
617-
618void qt_init_tooltip_palette()-
619{-
620#ifndef QT_NO_TOOLTIP-
621 if (const QPalette *toolTipPalette = QGuiApplicationPrivate::platformTheme()->palette(QPlatformTheme::ToolTipPalette))
const QPalette...oolTipPalette)Description
TRUEnever evaluated
FALSEnever evaluated
0
622 QToolTip::setPalette(*toolTipPalette);
never executed: QToolTip::setPalette(*toolTipPalette);
0
623#endif-
624}
never executed: end of block
0
625-
626#ifndef QT_NO_STATEMACHINE-
627void qRegisterGuiStateMachine();-
628void qUnregisterGuiStateMachine();-
629#endif-
630extern void qRegisterWidgetsVariant();-
631-
632/*!-
633 \fn void QApplicationPrivate::initialize()-
634-
635 Initializes the QApplication object, called from the constructors.-
636*/-
637void QApplicationPrivate::initialize()-
638{-
639 is_app_running = false; // Starting up.-
640-
641 QWidgetPrivate::mapper = new QWidgetMapper;-
642 QWidgetPrivate::allWidgets = new QWidgetSet;-
643-
644 // needed for a static build.-
645 qRegisterWidgetsVariant();-
646-
647 // needed for widgets in QML-
648 QAbstractDeclarativeData::setWidgetParent = QWidgetPrivate::setWidgetParentHelper;-
649-
650 if (application_type != QApplicationPrivate::Tty)
application_ty...onPrivate::TtyDescription
TRUEnever evaluated
FALSEnever evaluated
0
651 (void) QApplication::style(); // trigger creation of application style
never executed: (void) QApplication::style();
0
652#ifndef QT_NO_STATEMACHINE-
653 // trigger registering of QStateMachine's GUI types-
654 qRegisterGuiStateMachine();-
655#endif-
656-
657 if (qEnvironmentVariableIntValue("QT_USE_NATIVE_WINDOWS") > 0)
qEnvironmentVa..._WINDOWS") > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
658 QCoreApplication::setAttribute(Qt::AA_NativeWindows);
never executed: QCoreApplication::setAttribute(Qt::AA_NativeWindows);
0
659-
660#ifdef Q_OS_WINCE-
661#ifdef QT_AUTO_MAXIMIZE_THRESHOLD-
662 autoMaximizeThreshold = QT_AUTO_MAXIMIZE_THRESHOLD;-
663#else-
664 if (qt_wince_is_mobile())-
665 autoMaximizeThreshold = 50;-
666 else-
667 autoMaximizeThreshold = -1;-
668#endif //QT_AUTO_MAXIMIZE_THRESHOLD-
669#endif //Q_OS_WINCE-
670-
671#ifndef QT_NO_WHEELEVENT-
672 QApplicationPrivate::wheel_scroll_lines = 3;-
673#endif-
674-
675 if (qt_is_gui_used)
qt_is_gui_usedDescription
TRUEnever evaluated
FALSEnever evaluated
0
676 initializeMultitouch();
never executed: initializeMultitouch();
0
677-
678 if (QApplication::desktopSettingsAware())
QApplication::...ettingsAware()Description
TRUEnever evaluated
FALSEnever evaluated
0
679 if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
const QPlatfor...latformTheme()Description
TRUEnever evaluated
FALSEnever evaluated
0
680 QApplicationPrivate::enabledAnimations = theme->themeHint(QPlatformTheme::UiEffects).toInt();-
681#ifndef QT_NO_WHEELEVENT-
682 QApplicationPrivate::wheel_scroll_lines = theme->themeHint(QPlatformTheme::WheelScrollLines).toInt();-
683#endif-
684 }
never executed: end of block
0
685-
686 is_app_running = true; // no longer starting up-
687}
never executed: end of block
0
688-
689static void setPossiblePalette(const QPalette *palette, const char *className)-
690{-
691 if (palette == 0)
palette == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
692 return;
never executed: return;
0
693 QApplicationPrivate::setPalette_helper(*palette, className, false);-
694}
never executed: end of block
0
695-
696void QApplicationPrivate::initializeWidgetPaletteHash()-
697{-
698 QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme();-
699 if (!platformTheme)
!platformThemeDescription
TRUEnever evaluated
FALSEnever evaluated
0
700 return;
never executed: return;
0
701 qt_app_palettes_hash()->clear();-
702-
703 setPossiblePalette(platformTheme->palette(QPlatformTheme::ToolButtonPalette), "QToolButton");-
704 setPossiblePalette(platformTheme->palette(QPlatformTheme::ButtonPalette), "QAbstractButton");-
705 setPossiblePalette(platformTheme->palette(QPlatformTheme::CheckBoxPalette), "QCheckBox");-
706 setPossiblePalette(platformTheme->palette(QPlatformTheme::RadioButtonPalette), "QRadioButton");-
707 setPossiblePalette(platformTheme->palette(QPlatformTheme::HeaderPalette), "QHeaderView");-
708 setPossiblePalette(platformTheme->palette(QPlatformTheme::ItemViewPalette), "QAbstractItemView");-
709 setPossiblePalette(platformTheme->palette(QPlatformTheme::MessageBoxLabelPalette), "QMessageBoxLabel");-
710 setPossiblePalette(platformTheme->palette(QPlatformTheme::TabBarPalette), "QTabBar");-
711 setPossiblePalette(platformTheme->palette(QPlatformTheme::LabelPalette), "QLabel");-
712 setPossiblePalette(platformTheme->palette(QPlatformTheme::GroupBoxPalette), "QGroupBox");-
713 setPossiblePalette(platformTheme->palette(QPlatformTheme::MenuPalette), "QMenu");-
714 setPossiblePalette(platformTheme->palette(QPlatformTheme::MenuBarPalette), "QMenuBar");-
715 setPossiblePalette(platformTheme->palette(QPlatformTheme::TextEditPalette), "QTextEdit");-
716 setPossiblePalette(platformTheme->palette(QPlatformTheme::TextEditPalette), "QTextControl");-
717 setPossiblePalette(platformTheme->palette(QPlatformTheme::TextLineEditPalette), "QLineEdit");-
718}
never executed: end of block
0
719-
720void QApplicationPrivate::initializeWidgetFontHash()-
721{-
722 const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme();-
723 if (!theme)
!themeDescription
TRUEnever evaluated
FALSEnever evaluated
0
724 return;
never executed: return;
0
725 FontHash *fontHash = qt_app_fonts_hash();-
726 fontHash->clear();-
727-
728 if (const QFont *font = theme->font(QPlatformTheme::MenuFont))
const QFont *f...eme::MenuFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
729 fontHash->insert(QByteArrayLiteral("QMenu"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QMenu") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QMenu" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
730 if (const QFont *font = theme->font(QPlatformTheme::MenuBarFont))
const QFont *f...::MenuBarFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
731 fontHash->insert(QByteArrayLiteral("QMenuBar"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QMenuBar") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QMenuBar" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
732 if (const QFont *font = theme->font(QPlatformTheme::MenuItemFont))
const QFont *f...:MenuItemFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
733 fontHash->insert(QByteArrayLiteral("QMenuItem"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QMenuItem") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QMenuItem" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
734 if (const QFont *font = theme->font(QPlatformTheme::MessageBoxFont))
const QFont *f...essageBoxFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
735 fontHash->insert(QByteArrayLiteral("QMessageBox"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QMessageBox") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QMessageBox" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
736 if (const QFont *font = theme->font(QPlatformTheme::LabelFont))
const QFont *f...me::LabelFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
737 fontHash->insert(QByteArrayLiteral("QLabel"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QLabel") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QLabel" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
738 if (const QFont *font = theme->font(QPlatformTheme::TipLabelFont))
const QFont *f...:TipLabelFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
739 fontHash->insert(QByteArrayLiteral("QTipLabel"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QTipLabel") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QTipLabel" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
740 if (const QFont *font = theme->font(QPlatformTheme::TitleBarFont))
const QFont *f...:TitleBarFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
741 fontHash->insert(QByteArrayLiteral("QTitleBar"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QTitleBar") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QTitleBar" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
742 if (const QFont *font = theme->font(QPlatformTheme::StatusBarFont))
const QFont *f...StatusBarFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
743 fontHash->insert(QByteArrayLiteral("QStatusBar"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QStatusBar") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QStatusBar" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
744 if (const QFont *font = theme->font(QPlatformTheme::MdiSubWindowTitleFont))
const QFont *f...ndowTitleFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
745 fontHash->insert(QByteArrayLiteral("QMdiSubWindowTitleBar"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QMdiSubWindowTitleBar") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QMdiSubWindowTitleBar" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
746 if (const QFont *font = theme->font(QPlatformTheme::DockWidgetTitleFont))
const QFont *f...dgetTitleFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
747 fontHash->insert(QByteArrayLiteral("QDockWidgetTitle"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QDockWidgetTitle") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QDockWidgetTitle" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
748 if (const QFont *font = theme->font(QPlatformTheme::PushButtonFont))
const QFont *f...ushButtonFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
749 fontHash->insert(QByteArrayLiteral("QPushButton"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QPushButton") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QPushButton" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
750 if (const QFont *font = theme->font(QPlatformTheme::CheckBoxFont))
const QFont *f...:CheckBoxFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
751 fontHash->insert(QByteArrayLiteral("QCheckBox"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QCheckBox") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QCheckBox" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
752 if (const QFont *font = theme->font(QPlatformTheme::RadioButtonFont))
const QFont *f...dioButtonFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
753 fontHash->insert(QByteArrayLiteral("QRadioButton"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QRadioButton") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QRadioButton" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
754 if (const QFont *font = theme->font(QPlatformTheme::ToolButtonFont))
const QFont *f...oolButtonFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
755 fontHash->insert(QByteArrayLiteral("QToolButton"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QToolButton") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QToolButton" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
756 if (const QFont *font = theme->font(QPlatformTheme::ItemViewFont))
const QFont *f...:ItemViewFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
757 fontHash->insert(QByteArrayLiteral("QAbstractItemView"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QAbstractItemView") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QAbstractItemView" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
758 if (const QFont *font = theme->font(QPlatformTheme::ListViewFont))
const QFont *f...:ListViewFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
759 fontHash->insert(QByteArrayLiteral("QListView"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QListView") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QListView" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
760 if (const QFont *font = theme->font(QPlatformTheme::HeaderViewFont))
const QFont *f...eaderViewFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
761 fontHash->insert(QByteArrayLiteral("QHeaderView"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QHeaderView") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QHeaderView" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
762 if (const QFont *font = theme->font(QPlatformTheme::ListBoxFont))
const QFont *f...::ListBoxFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
763 fontHash->insert(QByteArrayLiteral("QListBox"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QListBox") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QListBox" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
764 if (const QFont *font = theme->font(QPlatformTheme::ComboMenuItemFont))
const QFont *f...oMenuItemFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
765 fontHash->insert(QByteArrayLiteral("QComboMenuItem"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QComboMenuItem") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QComboMenuItem" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
766 if (const QFont *font = theme->font(QPlatformTheme::ComboLineEditFont))
const QFont *f...oLineEditFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
767 fontHash->insert(QByteArrayLiteral("QComboLineEdit"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QComboLineEdit") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QComboLineEdit" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
768 if (const QFont *font = theme->font(QPlatformTheme::SmallFont))
const QFont *f...me::SmallFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
769 fontHash->insert(QByteArrayLiteral("QSmallFont"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QSmallFont") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QSmallFont" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
770 if (const QFont *font = theme->font(QPlatformTheme::MiniFont))
const QFont *f...eme::MiniFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
771 fontHash->insert(QByteArrayLiteral("QMiniFont"), *font);
never executed: fontHash->insert(([]() -> QByteArray { enum { Size = sizeof("QMiniFont") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "QMiniFont" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()), *font);
never executed: return ba;
0
772}
never executed: end of block
0
773-
774/*****************************************************************************-
775 Functions returning the active popup and modal widgets.-
776 *****************************************************************************/-
777-
778/*!-
779 Returns the active popup widget.-
780-
781 A popup widget is a special top-level widget that sets the \c-
782 Qt::WType_Popup widget flag, e.g. the QMenu widget. When the application-
783 opens a popup widget, all events are sent to the popup. Normal widgets and-
784 modal widgets cannot be accessed before the popup widget is closed.-
785-
786 Only other popup widgets may be opened when a popup widget is shown. The-
787 popup widgets are organized in a stack. This function returns the active-
788 popup widget at the top of the stack.-
789-
790 \sa activeModalWidget(), topLevelWidgets()-
791*/-
792-
793QWidget *QApplication::activePopupWidget()-
794{-
795 return QApplicationPrivate::popupWidgets && !QApplicationPrivate::popupWidgets->isEmpty() ?
never executed: return QApplicationPrivate::popupWidgets && !QApplicationPrivate::popupWidgets->isEmpty() ? QApplicationPrivate::popupWidgets->constLast() : nullptr;
0
796 QApplicationPrivate::popupWidgets->constLast() : nullptr;
never executed: return QApplicationPrivate::popupWidgets && !QApplicationPrivate::popupWidgets->isEmpty() ? QApplicationPrivate::popupWidgets->constLast() : nullptr;
0
797}-
798-
799-
800/*!-
801 Returns the active modal widget.-
802-
803 A modal widget is a special top-level widget which is a subclass of QDialog-
804 that specifies the modal parameter of the constructor as true. A modal-
805 widget must be closed before the user can continue with other parts of the-
806 program.-
807-
808 Modal widgets are organized in a stack. This function returns the active-
809 modal widget at the top of the stack.-
810-
811 \sa activePopupWidget(), topLevelWidgets()-
812*/-
813-
814QWidget *QApplication::activeModalWidget()-
815{-
816 QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(modalWindow());-
817 return widgetWindow ? widgetWindow->widget() : 0;
never executed: return widgetWindow ? widgetWindow->widget() : 0;
0
818}-
819-
820/*!-
821 Cleans up any window system resources that were allocated by this-
822 application. Sets the global variable \c qApp to 0.-
823*/-
824-
825QApplication::~QApplication()-
826{-
827 Q_D(QApplication);-
828-
829 //### this should probable be done even later-
830 qt_call_post_routines();-
831-
832 // kill timers before closing down the dispatcher-
833 d->toolTipWakeUp.stop();-
834 d->toolTipFallAsleep.stop();-
835-
836 QApplicationPrivate::is_app_closing = true;-
837 QApplicationPrivate::is_app_running = false;-
838-
839 delete QWidgetPrivate::mapper;-
840 QWidgetPrivate::mapper = 0;-
841-
842 // delete all widgets-
843 if (QWidgetPrivate::allWidgets) {
QWidgetPrivate::allWidgetsDescription
TRUEnever evaluated
FALSEnever evaluated
0
844 QWidgetSet *mySet = QWidgetPrivate::allWidgets;-
845 QWidgetPrivate::allWidgets = 0;-
846 for (QWidgetSet::ConstIterator it = mySet->constBegin(), cend = mySet->constEnd(); it != cend; ++it) {
it != cendDescription
TRUEnever evaluated
FALSEnever evaluated
0
847 QWidget *w = *it;-
848 if (!w->parent()) // window
!w->parent()Description
TRUEnever evaluated
FALSEnever evaluated
0
849 w->destroy(true, true);
never executed: w->destroy(true, true);
0
850 }
never executed: end of block
0
851 delete mySet;-
852 }
never executed: end of block
0
853-
854 delete qt_desktopWidget;-
855 qt_desktopWidget = 0;-
856-
857 delete QApplicationPrivate::app_pal;-
858 QApplicationPrivate::app_pal = 0;-
859 clearSystemPalette();-
860 delete QApplicationPrivate::set_pal;-
861 QApplicationPrivate::set_pal = 0;-
862 app_palettes()->clear();-
863-
864 delete QApplicationPrivate::sys_font;-
865 QApplicationPrivate::sys_font = 0;-
866 delete QApplicationPrivate::set_font;-
867 QApplicationPrivate::set_font = 0;-
868 app_fonts()->clear();-
869-
870 delete QApplicationPrivate::app_style;-
871 QApplicationPrivate::app_style = 0;-
872-
873#ifndef QT_NO_DRAGANDDROP-
874 if (qt_is_gui_used)
qt_is_gui_usedDescription
TRUEnever evaluated
FALSEnever evaluated
0
875 delete QDragManager::self();
never executed: delete QDragManager::self();
0
876#endif-
877-
878 d->cleanupMultitouch();-
879-
880 qt_cleanup();-
881-
882 if (QApplicationPrivate::widgetCount)
QApplicationPr...e::widgetCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
883 qDebug("Widgets left: %i Max widgets: %i \n", QWidgetPrivate::instanceCounter, QWidgetPrivate::maxInstances);
never executed: QMessageLogger(__FILE__, 883, __PRETTY_FUNCTION__).debug("Widgets left: %i Max widgets: %i \n", QWidgetPrivate::instanceCounter, QWidgetPrivate::maxInstances);
0
884-
885 QApplicationPrivate::obey_desktop_settings = true;-
886-
887 QApplicationPrivate::app_strut = QSize(0, 0);-
888 QApplicationPrivate::enabledAnimations = QPlatformTheme::GeneralUiEffect;-
889 QApplicationPrivate::widgetCount = false;-
890-
891#ifndef QT_NO_STATEMACHINE-
892 // trigger unregistering of QStateMachine's GUI types-
893 qUnregisterGuiStateMachine();-
894#endif-
895}
never executed: end of block
0
896-
897#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)-
898// #fixme: Remove.-
899static HDC displayDC = 0; // display device context-
900-
901Q_WIDGETS_EXPORT HDC qt_win_display_dc() // get display DC-
902{-
903 Q_ASSERT(qApp && qApp->thread() == QThread::currentThread());-
904 if (!displayDC)-
905 displayDC = GetDC(0);-
906 return displayDC;-
907}-
908#endif-
909-
910void qt_cleanup()-
911{-
912 QPixmapCache::clear();-
913 QColormap::cleanup();-
914-
915 QApplicationPrivate::active_window = 0; //### this should not be necessary-
916#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)-
917 if (displayDC) {-
918 ReleaseDC(0, displayDC);-
919 displayDC = 0;-
920 }-
921#endif-
922}
never executed: end of block
0
923-
924/*!-
925 \fn QWidget *QApplication::widgetAt(const QPoint &point)-
926-
927 Returns the widget at global screen position \a point, or 0 if there is no-
928 Qt widget there.-
929-
930 This function can be slow.-
931-
932 \sa QCursor::pos(), QWidget::grabMouse(), QWidget::grabKeyboard()-
933*/-
934QWidget *QApplication::widgetAt(const QPoint &p)-
935{-
936 QWidget *window = QApplication::topLevelAt(p);-
937 if (!window)
!windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
938 return 0;
never executed: return 0;
0
939-
940 QWidget *child = 0;-
941-
942 if (!window->testAttribute(Qt::WA_TransparentForMouseEvents))
!window->testA...orMouseEvents)Description
TRUEnever evaluated
FALSEnever evaluated
0
943 child = window->childAt(window->mapFromGlobal(p));
never executed: child = window->childAt(window->mapFromGlobal(p));
0
944-
945 if (child)
childDescription
TRUEnever evaluated
FALSEnever evaluated
0
946 return child;
never executed: return child;
0
947-
948 if (window->testAttribute(Qt::WA_TransparentForMouseEvents)) {
window->testAt...orMouseEvents)Description
TRUEnever evaluated
FALSEnever evaluated
0
949 //shoot a hole in the widget and try once again,-
950 //suboptimal on Qt for Embedded Linux where we do-
951 //know the stacking order of the toplevels.-
952 int x = p.x();-
953 int y = p.y();-
954 QRegion oldmask = window->mask();-
955 QPoint wpoint = window->mapFromGlobal(QPoint(x, y));-
956 QRegion newmask = (oldmask.isEmpty() ? QRegion(window->rect()) : oldmask)
oldmask.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
957 - QRegion(wpoint.x(), wpoint.y(), 1, 1);-
958 window->setMask(newmask);-
959 QWidget *recurse = 0;-
960 if (QApplication::topLevelAt(p) != window) // verify recursion will terminate
QApplication::...t(p) != windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
961 recurse = widgetAt(x, y);
never executed: recurse = widgetAt(x, y);
0
962 if (oldmask.isEmpty())
oldmask.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
963 window->clearMask();
never executed: window->clearMask();
0
964 else-
965 window->setMask(oldmask);
never executed: window->setMask(oldmask);
0
966 return recurse;
never executed: return recurse;
0
967 }-
968 return window;
never executed: return window;
0
969}-
970-
971/*!-
972 \fn QWidget *QApplication::widgetAt(int x, int y)-
973-
974 \overload-
975-
976 Returns the widget at global screen position (\a x, \a y), or 0 if there is-
977 no Qt widget there.-
978*/-
979-
980/*!-
981 \internal-
982*/-
983bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents)-
984{-
985 if ((event->type() == QEvent::UpdateRequest
event->type() ...:UpdateRequestDescription
TRUEnever evaluated
FALSEnever evaluated
0
986 || event->type() == QEvent::LayoutRequest
event->type() ...:LayoutRequestDescription
TRUEnever evaluated
FALSEnever evaluated
0
987 || event->type() == QEvent::Resize
event->type() ...QEvent::ResizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
988 || event->type() == QEvent::Move
event->type() == QEvent::MoveDescription
TRUEnever evaluated
FALSEnever evaluated
0
989 || event->type() == QEvent::LanguageChange)) {
event->type() ...LanguageChangeDescription
TRUEnever evaluated
FALSEnever evaluated
0
990 for (QPostEventList::const_iterator it = postedEvents->constBegin(); it != postedEvents->constEnd(); ++it) {
it != postedEvents->constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
0
991 const QPostEvent &cur = *it;-
992 if (cur.receiver != receiver || cur.event == 0 || cur.event->type() != event->type())
cur.receiver != receiverDescription
TRUEnever evaluated
FALSEnever evaluated
cur.event == 0Description
TRUEnever evaluated
FALSEnever evaluated
cur.event->typ... event->type()Description
TRUEnever evaluated
FALSEnever evaluated
0
993 continue;
never executed: continue;
0
994 if (cur.event->type() == QEvent::LayoutRequest
cur.event->typ...:LayoutRequestDescription
TRUEnever evaluated
FALSEnever evaluated
0
995 || cur.event->type() == QEvent::UpdateRequest) {
cur.event->typ...:UpdateRequestDescription
TRUEnever evaluated
FALSEnever evaluated
0
996 ;-
997 } else if (cur.event->type() == QEvent::Resize) {
never executed: end of block
cur.event->typ...QEvent::ResizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
998 ((QResizeEvent *)(cur.event))->s = ((QResizeEvent *)event)->s;-
999 } else if (cur.event->type() == QEvent::Move) {
never executed: end of block
cur.event->typ...= QEvent::MoveDescription
TRUEnever evaluated
FALSEnever evaluated
0
1000 ((QMoveEvent *)(cur.event))->p = ((QMoveEvent *)event)->p;-
1001 } else if (cur.event->type() == QEvent::LanguageChange) {
never executed: end of block
cur.event->typ...LanguageChangeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1002 ;-
1003 } else {
never executed: end of block
0
1004 continue;
never executed: continue;
0
1005 }-
1006 delete event;-
1007 return true;
never executed: return true;
0
1008 }-
1009 return false;
never executed: return false;
0
1010 }-
1011 return QGuiApplication::compressEvent(event, receiver, postedEvents);
never executed: return QGuiApplication::compressEvent(event, receiver, postedEvents);
0
1012}-
1013-
1014/*!-
1015 \property QApplication::styleSheet-
1016 \brief the application style sheet-
1017 \since 4.2-
1018-
1019 By default, this property returns an empty string unless the user specifies-
1020 the \c{-stylesheet} option on the command line when running the application.-
1021-
1022 \sa QWidget::setStyle(), {Qt Style Sheets}-
1023*/-
1024-
1025/*!-
1026 \property QApplication::autoMaximizeThreshold-
1027 \since 4.4-
1028 \brief defines a threshold for auto maximizing widgets-
1029 \deprecated-
1030 \b{The auto maximize threshold is only available as part of Qt for-
1031 Windows CE.}-
1032-
1033 This property defines a threshold for the size of a window as a percentage-
1034 of the screen size. If the minimum size hint of a window exceeds the-
1035 threshold, calling show() will cause the window to be maximized-
1036 automatically.-
1037-
1038 Setting the threshold to 100 or greater means that the widget will always-
1039 be maximized. Alternatively, setting the threshold to 50 means that the-
1040 widget will be maximized only if the vertical minimum size hint is at least-
1041 50% of the vertical screen size.-
1042-
1043 Setting the threshold to -1 disables the feature.-
1044-
1045 On Windows CE the default is -1 (i.e., it is disabled).-
1046 On Windows Mobile the default is 40.-
1047*/-
1048-
1049/*!-
1050 \property QApplication::autoSipEnabled-
1051 \since 4.5-
1052 \brief toggles automatic SIP (software input panel) visibility-
1053-
1054 Set this property to \c true to automatically display the SIP when entering-
1055 widgets that accept keyboard input. This property only affects widgets with-
1056 the WA_InputMethodEnabled attribute set, and is typically used to launch-
1057 a virtual keyboard on devices which have very few or no keys.-
1058-
1059 \b{ The property only has an effect on platforms that use software input-
1060 panels.}-
1061-
1062 The default is platform dependent.-
1063*/-
1064-
1065#ifdef Q_OS_WINCE-
1066void QApplication::setAutoMaximizeThreshold(const int threshold)-
1067{-
1068 QApplicationPrivate::autoMaximizeThreshold = threshold;-
1069}-
1070-
1071int QApplication::autoMaximizeThreshold() const-
1072{-
1073 return QApplicationPrivate::autoMaximizeThreshold;-
1074}-
1075#endif-
1076-
1077void QApplication::setAutoSipEnabled(const bool enabled)-
1078{-
1079 QApplicationPrivate::autoSipEnabled = enabled;-
1080}
never executed: end of block
0
1081-
1082bool QApplication::autoSipEnabled() const-
1083{-
1084 return QApplicationPrivate::autoSipEnabled;
never executed: return QApplicationPrivate::autoSipEnabled;
0
1085}-
1086-
1087#ifndef QT_NO_STYLE_STYLESHEET-
1088-
1089QString QApplication::styleSheet() const-
1090{-
1091 return QApplicationPrivate::styleSheet;
never executed: return QApplicationPrivate::styleSheet;
0
1092}-
1093-
1094void QApplication::setStyleSheet(const QString& styleSheet)-
1095{-
1096 QApplicationPrivate::styleSheet = styleSheet;-
1097 QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle*>(QApplicationPrivate::app_style);-
1098 if (styleSheet.isEmpty()) { // application style sheet removed
styleSheet.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1099 if (!proxy)
!proxyDescription
TRUEnever evaluated
FALSEnever evaluated
0
1100 return; // there was no stylesheet before
never executed: return;
0
1101 setStyle(proxy->base);-
1102 } else if (proxy) { // style sheet update, just repolish
never executed: end of block
proxyDescription
TRUEnever evaluated
FALSEnever evaluated
0
1103 proxy->repolish(qApp);-
1104 } else { // stylesheet set the first time
never executed: end of block
0
1105 QStyleSheetStyle *newProxy = new QStyleSheetStyle(QApplicationPrivate::app_style);-
1106 QApplicationPrivate::app_style->setParent(newProxy);-
1107 setStyle(newProxy);-
1108 }
never executed: end of block
0
1109}-
1110-
1111#endif // QT_NO_STYLE_STYLESHEET-
1112-
1113/*!-
1114 Returns the application's style object.-
1115-
1116 \sa setStyle(), QStyle-
1117*/-
1118QStyle *QApplication::style()-
1119{-
1120 if (QApplicationPrivate::app_style)
QApplicationPrivate::app_styleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1121 return QApplicationPrivate::app_style;
never executed: return QApplicationPrivate::app_style;
0
1122 if (!qobject_cast<QApplication *>(QCoreApplication::instance())) {
!qobject_cast<...n::instance())Description
TRUEnever evaluated
FALSEnever evaluated
0
1123 Q_ASSERT(!"No style available without QApplication!");-
1124 return 0;
never executed: return 0;
0
1125 }-
1126-
1127 if (!QApplicationPrivate::app_style) {
!QApplicationP...ate::app_styleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1128 // Compile-time search for default style-
1129 //-
1130 QString style;-
1131 if (!QApplicationPrivate::styleOverride.isEmpty()) {
!QApplicationP...ride.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1132 style = QApplicationPrivate::styleOverride.toLower();-
1133 } else {
never executed: end of block
0
1134 style = QApplicationPrivate::desktopStyleKey();-
1135 }
never executed: end of block
0
1136-
1137 QStyle *&app_style = QApplicationPrivate::app_style;-
1138 app_style = QStyleFactory::create(style);-
1139 if (!app_style) {
!app_styleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1140 const QStringList styles = QStyleFactory::keys();-
1141 for (const auto &style : styles) {-
1142 if ((app_style = QStyleFactory::create(style)))
(app_style = Q...create(style))Description
TRUEnever evaluated
FALSEnever evaluated
0
1143 break;
never executed: break;
0
1144 }
never executed: end of block
0
1145 }
never executed: end of block
0
1146 if (!app_style) {
!app_styleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1147 Q_ASSERT(!"No styles available!");-
1148 return 0;
never executed: return 0;
0
1149 }-
1150 QApplicationPrivate::overrides_native_style =-
1151 app_style->objectName() != QApplicationPrivate::desktopStyleKey();-
1152 }
never executed: end of block
0
1153 // take ownership of the style-
1154 QApplicationPrivate::app_style->setParent(qApp);-
1155-
1156 initSystemPalette();-
1157-
1158 if (QApplicationPrivate::set_pal) // repolish set palette with the new style
QApplicationPrivate::set_palDescription
TRUEnever evaluated
FALSEnever evaluated
0
1159 QApplication::setPalette(*QApplicationPrivate::set_pal);
never executed: QApplication::setPalette(*QApplicationPrivate::set_pal);
0
1160-
1161#ifndef QT_NO_STYLE_STYLESHEET-
1162 if (!QApplicationPrivate::styleSheet.isEmpty()) {
!QApplicationP...heet.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1163 qApp->setStyleSheet(QApplicationPrivate::styleSheet);-
1164 } else
never executed: end of block
0
1165#endif-
1166 QApplicationPrivate::app_style->polish(qApp);
never executed: QApplicationPrivate::app_style->polish((static_cast<QApplication *>(QCoreApplication::instance())));
0
1167-
1168 return QApplicationPrivate::app_style;
never executed: return QApplicationPrivate::app_style;
0
1169}-
1170-
1171/*!-
1172 Sets the application's GUI style to \a style. Ownership of the style object-
1173 is transferred to QApplication, so QApplication will delete the style-
1174 object on application exit or when a new style is set and the old style is-
1175 still the parent of the application object.-
1176-
1177 Example usage:-
1178 \snippet code/src_gui_kernel_qapplication.cpp 1-
1179-
1180 When switching application styles, the color palette is set back to the-
1181 initial colors or the system defaults. This is necessary since certain-
1182 styles have to adapt the color palette to be fully style-guide compliant.-
1183-
1184 Setting the style before a palette has been set, i.e., before creating-
1185 QApplication, will cause the application to use QStyle::standardPalette()-
1186 for the palette.-
1187-
1188 \warning Qt style sheets are currently not supported for custom QStyle-
1189 subclasses. We plan to address this in some future release.-
1190-
1191 \sa style(), QStyle, setPalette(), desktopSettingsAware()-
1192*/-
1193void QApplication::setStyle(QStyle *style)-
1194{-
1195 if (!style || style == QApplicationPrivate::app_style)
!styleDescription
TRUEnever evaluated
FALSEnever evaluated
style == QAppl...ate::app_styleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1196 return;
never executed: return;
0
1197-
1198 QWidgetList all = allWidgets();-
1199-
1200 // clean up the old style-
1201 if (QApplicationPrivate::app_style) {
QApplicationPrivate::app_styleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1202 if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) {
QApplicationPr...is_app_runningDescription
TRUEnever evaluated
FALSEnever evaluated
!QApplicationP...is_app_closingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1203 for (QWidgetList::ConstIterator it = all.constBegin(), cend = all.constEnd(); it != cend; ++it) {
it != cendDescription
TRUEnever evaluated
FALSEnever evaluated
0
1204 QWidget *w = *it;-
1205 if (!(w->windowType() == Qt::Desktop) && // except desktop
!(w->windowTyp...= Qt::Desktop)Description
TRUEnever evaluated
FALSEnever evaluated
0
1206 w->testAttribute(Qt::WA_WState_Polished)) { // has been polished
w->testAttribu...tate_Polished)Description
TRUEnever evaluated
FALSEnever evaluated
0
1207 QApplicationPrivate::app_style->unpolish(w);-
1208 }
never executed: end of block
0
1209 }
never executed: end of block
0
1210 }
never executed: end of block
0
1211 QApplicationPrivate::app_style->unpolish(qApp);-
1212 }
never executed: end of block
0
1213-
1214 QStyle *old = QApplicationPrivate::app_style; // save-
1215-
1216 QApplicationPrivate::overrides_native_style =-
1217 nativeStyleClassName() == QByteArray(style->metaObject()->className());-
1218-
1219#ifndef QT_NO_STYLE_STYLESHEET-
1220 if (!QApplicationPrivate::styleSheet.isEmpty() && !qobject_cast<QStyleSheetStyle *>(style)) {
!QApplicationP...heet.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
!qobject_cast<...tyle *>(style)Description
TRUEnever evaluated
FALSEnever evaluated
0
1221 // we have a stylesheet already and a new style is being set-
1222 QStyleSheetStyle *newProxy = new QStyleSheetStyle(style);-
1223 style->setParent(newProxy);-
1224 QApplicationPrivate::app_style = newProxy;-
1225 } else
never executed: end of block
0
1226#endif // QT_NO_STYLE_STYLESHEET-
1227 QApplicationPrivate::app_style = style;
never executed: QApplicationPrivate::app_style = style;
0
1228 QApplicationPrivate::app_style->setParent(qApp); // take ownership-
1229-
1230 // take care of possible palette requirements of certain gui-
1231 // styles. Do it before polishing the application since the style-
1232 // might call QApplication::setPalette() itself-
1233 if (QApplicationPrivate::set_pal) {
QApplicationPrivate::set_palDescription
TRUEnever evaluated
FALSEnever evaluated
0
1234 QApplication::setPalette(*QApplicationPrivate::set_pal);-
1235 } else if (QApplicationPrivate::sys_pal) {
never executed: end of block
QApplicationPrivate::sys_palDescription
TRUEnever evaluated
FALSEnever evaluated
0
1236 clearSystemPalette();-
1237 initSystemPalette();-
1238 QApplicationPrivate::initializeWidgetPaletteHash();-
1239 QApplicationPrivate::initializeWidgetFontHash();-
1240 QApplicationPrivate::setPalette_helper(*QApplicationPrivate::sys_pal, /*className=*/0, /*clearWidgetPaletteHash=*/false);-
1241 } else if (!QApplicationPrivate::sys_pal) {
never executed: end of block
!QApplicationPrivate::sys_palDescription
TRUEnever evaluated
FALSEnever evaluated
0
1242 // Initialize the sys_pal if it hasn't happened yet...-
1243 QApplicationPrivate::setSystemPalette(QApplicationPrivate::app_style->standardPalette());-
1244 }
never executed: end of block
0
1245-
1246 // initialize the application with the new style-
1247 QApplicationPrivate::app_style->polish(qApp);-
1248-
1249 // re-polish existing widgets if necessary-
1250 if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) {
QApplicationPr...is_app_runningDescription
TRUEnever evaluated
FALSEnever evaluated
!QApplicationP...is_app_closingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1251 for (QWidgetList::ConstIterator it = all.constBegin(), cend = all.constEnd(); it != cend; ++it) {
it != cendDescription
TRUEnever evaluated
FALSEnever evaluated
0
1252 QWidget *w = *it;-
1253 if (w->windowType() != Qt::Desktop && w->testAttribute(Qt::WA_WState_Polished)) {
w->windowType() != Qt::DesktopDescription
TRUEnever evaluated
FALSEnever evaluated
w->testAttribu...tate_Polished)Description
TRUEnever evaluated
FALSEnever evaluated
0
1254 if (w->style() == QApplicationPrivate::app_style)
w->style() == ...ate::app_styleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1255 QApplicationPrivate::app_style->polish(w); // repolish
never executed: QApplicationPrivate::app_style->polish(w);
0
1256#ifndef QT_NO_STYLE_STYLESHEET-
1257 else-
1258 w->setStyleSheet(w->styleSheet()); // touch
never executed: w->setStyleSheet(w->styleSheet());
0
1259#endif-
1260 }-
1261 }
never executed: end of block
0
1262-
1263 for (QWidgetList::ConstIterator it = all.constBegin(), cend = all.constEnd(); it != cend; ++it) {
it != cendDescription
TRUEnever evaluated
FALSEnever evaluated
0
1264 QWidget *w = *it;-
1265 if (w->windowType() != Qt::Desktop && !w->testAttribute(Qt::WA_SetStyle)) {
w->windowType() != Qt::DesktopDescription
TRUEnever evaluated
FALSEnever evaluated
!w->testAttrib...::WA_SetStyle)Description
TRUEnever evaluated
FALSEnever evaluated
0
1266 QEvent e(QEvent::StyleChange);-
1267 QApplication::sendEvent(w, &e);-
1268 w->update();-
1269 }
never executed: end of block
0
1270 }
never executed: end of block
0
1271 }
never executed: end of block
0
1272-
1273#ifndef QT_NO_STYLE_STYLESHEET-
1274 if (QStyleSheetStyle *oldProxy = qobject_cast<QStyleSheetStyle *>(old)) {
QStyleSheetSty...tStyle *>(old)Description
TRUEnever evaluated
FALSEnever evaluated
0
1275 oldProxy->deref();-
1276 } else
never executed: end of block
0
1277#endif-
1278 if (old && old->parent() == qApp) {
oldDescription
TRUEnever evaluated
FALSEnever evaluated
old->parent() ...::instance()))Description
TRUEnever evaluated
FALSEnever evaluated
0
1279 delete old;-
1280 }
never executed: end of block
0
1281-
1282 if (QApplicationPrivate::focus_widget) {
QApplicationPr...::focus_widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
1283 QFocusEvent in(QEvent::FocusIn, Qt::OtherFocusReason);-
1284 QApplication::sendEvent(QApplicationPrivate::focus_widget->style(), &in);-
1285 QApplicationPrivate::focus_widget->update();-
1286 }
never executed: end of block
0
1287}
never executed: end of block
0
1288-
1289/*!-
1290 \overload-
1291-
1292 Requests a QStyle object for \a style from the QStyleFactory.-
1293-
1294 The string must be one of the QStyleFactory::keys(), typically one of-
1295 "windows", "fusion", "windowsxp", or "macintosh". Style-
1296 names are case insensitive.-
1297-
1298 Returns 0 if an unknown \a style is passed, otherwise the QStyle object-
1299 returned is set as the application's GUI style.-
1300-
1301 \warning To ensure that the application's style is set correctly, it is-
1302 best to call this function before the QApplication constructor, if-
1303 possible.-
1304*/-
1305QStyle* QApplication::setStyle(const QString& style)-
1306{-
1307 QStyle *s = QStyleFactory::create(style);-
1308 if (!s)
!sDescription
TRUEnever evaluated
FALSEnever evaluated
0
1309 return 0;
never executed: return 0;
0
1310-
1311 setStyle(s);-
1312 return s;
never executed: return s;
0
1313}-
1314-
1315/*!-
1316 Returns the color specification.-
1317-
1318 \sa QApplication::setColorSpec()-
1319*/-
1320-
1321int QApplication::colorSpec()-
1322{-
1323 return QApplicationPrivate::app_cspec;
never executed: return QApplicationPrivate::app_cspec;
0
1324}-
1325-
1326/*!-
1327 Sets the color specification for the application to \a spec.-
1328-
1329 The color specification controls how the application allocates colors when-
1330 run on a display with a limited amount of colors, e.g. 8 bit / 256 color-
1331 displays.-
1332-
1333 The color specification must be set before you create the QApplication-
1334 object.-
1335-
1336 The options are:-
1337 \list-
1338 \li QApplication::NormalColor. This is the default color allocation-
1339 strategy. Use this option if your application uses buttons, menus,-
1340 texts and pixmaps with few colors. With this option, the-
1341 application uses system global colors. This works fine for most-
1342 applications under X11, but on the Windows platform, it may cause-
1343 dithering of non-standard colors.-
1344 \li QApplication::CustomColor. Use this option if your application-
1345 needs a small number of custom colors. On X11, this option is the-
1346 same as NormalColor. On Windows, Qt creates a Windows palette, and-
1347 allocates colors to it on demand.-
1348 \li QApplication::ManyColor. Use this option if your application is-
1349 very color hungry, e.g., it requires thousands of colors. \br-
1350 Under X11 the effect is:-
1351 \list-
1352 \li For 256-color displays which have at best a 256 color true-
1353 color visual, the default visual is used, and colors are-
1354 allocated from a color cube. The color cube is the 6x6x6-
1355 (216 color) "Web palette" (the red, green, and blue-
1356 components always have one of the following values: 0x00,-
1357 0x33, 0x66, 0x99, 0xCC, or 0xFF), but the number of colors-
1358 can be changed by the \e -ncols option. The user can force-
1359 the application to use the true color visual with the-
1360 \l{QApplication::QApplication()}{-visual} option.-
1361 \li For 256-color displays which have a true color visual with-
1362 more than 256 colors, use that visual. Silicon Graphics X-
1363 servers this feature, for example. They provide an 8 bit-
1364 visual by default but can deliver true color when asked.-
1365 \endlist-
1366 On Windows, Qt creates a Windows palette, and fills it with a color-
1367 cube.-
1368 \endlist-
1369-
1370 Be aware that the CustomColor and ManyColor choices may lead to colormap-
1371 flashing: The foreground application gets (most) of the available colors,-
1372 while the background windows will look less attractive.-
1373-
1374 Example:-
1375-
1376 \snippet code/src_gui_kernel_qapplication.cpp 2-
1377-
1378 \sa colorSpec()-
1379*/-
1380-
1381void QApplication::setColorSpec(int spec)-
1382{-
1383 if (Q_UNLIKELY(qApp))
__builtin_expe...e()))), false)Description
TRUEnever evaluated
FALSEnever evaluated
0
1384 qWarning("QApplication::setColorSpec: This function must be "
never executed: QMessageLogger(__FILE__, 1384, __PRETTY_FUNCTION__).warning("QApplication::setColorSpec: This function must be " "called before the QApplication object is created");
0
1385 "called before the QApplication object is created");
never executed: QMessageLogger(__FILE__, 1384, __PRETTY_FUNCTION__).warning("QApplication::setColorSpec: This function must be " "called before the QApplication object is created");
0
1386 QApplicationPrivate::app_cspec = spec;-
1387}
never executed: end of block
0
1388-
1389/*!-
1390 \property QApplication::globalStrut-
1391 \brief the minimum size that any GUI element that the user can interact-
1392 with should have-
1393-
1394 For example, no button should be resized to be smaller than the global-
1395 strut size. The strut size should be considered when reimplementing GUI-
1396 controls that may be used on touch-screens or similar I/O devices.-
1397-
1398 Example:-
1399-
1400 \snippet code/src_gui_kernel_qapplication.cpp 3-
1401-
1402 By default, this property contains a QSize object with zero width and height.-
1403*/-
1404QSize QApplication::globalStrut()-
1405{-
1406 return QApplicationPrivate::app_strut;
never executed: return QApplicationPrivate::app_strut;
0
1407}-
1408-
1409void QApplication::setGlobalStrut(const QSize& strut)-
1410{-
1411 QApplicationPrivate::app_strut = strut;-
1412}
never executed: end of block
0
1413-
1414-
1415/*!-
1416 \fn QPalette QApplication::palette(const QWidget* widget)-
1417 \overload-
1418-
1419 If a \a widget is passed, the default palette for the widget's class is-
1420 returned. This may or may not be the application palette. In most cases-
1421 there is no special palette for certain types of widgets, but one notable-
1422 exception is the popup menu under Windows, if the user has defined a-
1423 special background color for menus in the display settings.-
1424-
1425 \sa setPalette(), QWidget::palette()-
1426*/-
1427QPalette QApplication::palette(const QWidget* w)-
1428{-
1429 typedef PaletteHash::const_iterator PaletteHashConstIt;-
1430-
1431 PaletteHash *hash = app_palettes();-
1432 if (w && hash && hash->size()) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
hashDescription
TRUEnever evaluated
FALSEnever evaluated
hash->size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1433 PaletteHashConstIt it = hash->constFind(w->metaObject()->className());-
1434 const PaletteHashConstIt cend = hash->constEnd();-
1435 if (it != cend)
it != cendDescription
TRUEnever evaluated
FALSEnever evaluated
0
1436 return *it;
never executed: return *it;
0
1437 for (it = hash->constBegin(); it != cend; ++it) {
it != cendDescription
TRUEnever evaluated
FALSEnever evaluated
0
1438 if (w->inherits(it.key()))
w->inherits(it.key())Description
TRUEnever evaluated
FALSEnever evaluated
0
1439 return it.value();
never executed: return it.value();
0
1440 }
never executed: end of block
0
1441 }
never executed: end of block
0
1442 return palette();
never executed: return palette();
0
1443}-
1444-
1445/*!-
1446 \overload-
1447-
1448 Returns the palette for widgets of the given \a className.-
1449-
1450 \sa setPalette(), QWidget::palette()-
1451*/-
1452QPalette QApplication::palette(const char *className)-
1453{-
1454 if (!QApplicationPrivate::app_pal)
!QApplicationPrivate::app_palDescription
TRUEnever evaluated
FALSEnever evaluated
0
1455 palette();
never executed: palette();
0
1456 PaletteHash *hash = app_palettes();-
1457 if (className && hash && hash->size()) {
classNameDescription
TRUEnever evaluated
FALSEnever evaluated
hashDescription
TRUEnever evaluated
FALSEnever evaluated
hash->size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1458 QHash<QByteArray, QPalette>::ConstIterator it = hash->constFind(className);-
1459 if (it != hash->constEnd())
it != hash->constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
0
1460 return *it;
never executed: return *it;
0
1461 }
never executed: end of block
0
1462 return *QApplicationPrivate::app_pal;
never executed: return *QApplicationPrivate::app_pal;
0
1463}-
1464-
1465void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash)-
1466{-
1467 QPalette pal = palette;-
1468-
1469 if (QApplicationPrivate::app_style)
QApplicationPrivate::app_styleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1470 QApplicationPrivate::app_style->polish(pal); // NB: non-const reference
never executed: QApplicationPrivate::app_style->polish(pal);
0
1471-
1472 bool all = false;-
1473 PaletteHash *hash = app_palettes();-
1474 if (!className) {
!classNameDescription
TRUEnever evaluated
FALSEnever evaluated
0
1475 if (QApplicationPrivate::app_pal && pal.isCopyOf(*QApplicationPrivate::app_pal))
QApplicationPrivate::app_palDescription
TRUEnever evaluated
FALSEnever evaluated
pal.isCopyOf(*...vate::app_pal)Description
TRUEnever evaluated
FALSEnever evaluated
0
1476 return;
never executed: return;
0
1477 if (!QApplicationPrivate::app_pal)
!QApplicationPrivate::app_palDescription
TRUEnever evaluated
FALSEnever evaluated
0
1478 QApplicationPrivate::app_pal = new QPalette(pal);
never executed: QApplicationPrivate::app_pal = new QPalette(pal);
0
1479 else-
1480 *QApplicationPrivate::app_pal = pal;
never executed: *QApplicationPrivate::app_pal = pal;
0
1481 if (hash && hash->size()) {
hashDescription
TRUEnever evaluated
FALSEnever evaluated
hash->size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1482 all = true;-
1483 if (clearWidgetPaletteHash)
clearWidgetPaletteHashDescription
TRUEnever evaluated
FALSEnever evaluated
0
1484 hash->clear();
never executed: hash->clear();
0
1485 }
never executed: end of block
0
1486 } else if (hash) {
never executed: end of block
hashDescription
TRUEnever evaluated
FALSEnever evaluated
0
1487 hash->insert(className, pal);-
1488 }
never executed: end of block
0
1489-
1490 if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) {
QApplicationPr...is_app_runningDescription
TRUEnever evaluated
FALSEnever evaluated
!QApplicationP...is_app_closingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1491 // Send ApplicationPaletteChange to qApp itself, and to the widgets.-
1492 QEvent e(QEvent::ApplicationPaletteChange);-
1493 QApplication::sendEvent(QApplication::instance(), &e);-
1494-
1495 QWidgetList wids = QApplication::allWidgets();-
1496 for (QWidgetList::ConstIterator it = wids.constBegin(), cend = wids.constEnd(); it != cend; ++it) {
it != cendDescription
TRUEnever evaluated
FALSEnever evaluated
0
1497 QWidget *w = *it;-
1498 if (all || (!className && w->isWindow()) || w->inherits(className)) // matching class
allDescription
TRUEnever evaluated
FALSEnever evaluated
!classNameDescription
TRUEnever evaluated
FALSEnever evaluated
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
w->inherits(className)Description
TRUEnever evaluated
FALSEnever evaluated
0
1499 QApplication::sendEvent(w, &e);
never executed: QApplication::sendEvent(w, &e);
0
1500 }
never executed: end of block
0
1501-
1502 // Send to all scenes as well.-
1503#ifndef QT_NO_GRAPHICSVIEW-
1504 QList<QGraphicsScene *> &scenes = qApp->d_func()->scene_list;-
1505 for (QList<QGraphicsScene *>::ConstIterator it = scenes.constBegin();-
1506 it != scenes.constEnd(); ++it) {
it != scenes.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
0
1507 QApplication::sendEvent(*it, &e);-
1508 }
never executed: end of block
0
1509#endif //QT_NO_GRAPHICSVIEW-
1510 }
never executed: end of block
0
1511 if (!className && (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))) {
!classNameDescription
TRUEnever evaluated
FALSEnever evaluated
!QApplicationPrivate::sys_palDescription
TRUEnever evaluated
FALSEnever evaluated
!palette.isCop...vate::sys_pal)Description
TRUEnever evaluated
FALSEnever evaluated
0
1512 if (!QApplicationPrivate::set_pal)
!QApplicationPrivate::set_palDescription
TRUEnever evaluated
FALSEnever evaluated
0
1513 QApplicationPrivate::set_pal = new QPalette(palette);
never executed: QApplicationPrivate::set_pal = new QPalette(palette);
0
1514 else-
1515 *QApplicationPrivate::set_pal = palette;
never executed: *QApplicationPrivate::set_pal = palette;
0
1516 QCoreApplication::setAttribute(Qt::AA_SetPalette);-
1517 }
never executed: end of block
0
1518}
never executed: end of block
0
1519-
1520/*!-
1521 Changes the default application palette to \a palette.-
1522-
1523 If \a className is passed, the change applies only to widgets that inherit-
1524 \a className (as reported by QObject::inherits()). If \a className is left-
1525 0, the change affects all widgets, thus overriding any previously set class-
1526 specific palettes.-
1527-
1528 The palette may be changed according to the current GUI style in-
1529 QStyle::polish().-
1530-
1531 \warning Do not use this function in conjunction with \l{Qt Style Sheets}.-
1532 When using style sheets, the palette of a widget can be customized using-
1533 the "color", "background-color", "selection-color",-
1534 "selection-background-color" and "alternate-background-color".-
1535-
1536 \note Some styles do not use the palette for all drawing, for instance, if-
1537 they make use of native theme engines. This is the case for the Windows XP,-
1538 Windows Vista, and \macos styles.-
1539-
1540 \sa QWidget::setPalette(), palette(), QStyle::polish()-
1541*/-
1542-
1543void QApplication::setPalette(const QPalette &palette, const char* className)-
1544{-
1545 QApplicationPrivate::setPalette_helper(palette, className, /*clearWidgetPaletteHash=*/ true);-
1546}
never executed: end of block
0
1547-
1548-
1549-
1550void QApplicationPrivate::setSystemPalette(const QPalette &pal)-
1551{-
1552 QPalette adjusted;-
1553-
1554#if 0-
1555 // adjust the system palette to avoid dithering-
1556 QColormap cmap = QColormap::instance();-
1557 if (cmap.depths() > 4 && cmap.depths() < 24) {-
1558 for (int g = 0; g < QPalette::NColorGroups; g++)-
1559 for (int i = 0; i < QPalette::NColorRoles; i++) {-
1560 QColor color = pal.color((QPalette::ColorGroup)g, (QPalette::ColorRole)i);-
1561 color = cmap.colorAt(cmap.pixel(color));-
1562 adjusted.setColor((QPalette::ColorGroup)g, (QPalette::ColorRole) i, color);-
1563 }-
1564 }-
1565#else-
1566 adjusted = pal;-
1567#endif-
1568-
1569 if (!sys_pal)
!sys_palDescription
TRUEnever evaluated
FALSEnever evaluated
0
1570 sys_pal = new QPalette(adjusted);
never executed: sys_pal = new QPalette(adjusted);
0
1571 else-
1572 *sys_pal = adjusted;
never executed: *sys_pal = adjusted;
0
1573-
1574-
1575 if (!QApplicationPrivate::set_pal)
!QApplicationPrivate::set_palDescription
TRUEnever evaluated
FALSEnever evaluated
0
1576 QApplication::setPalette(*sys_pal);
never executed: QApplication::setPalette(*sys_pal);
0
1577}
never executed: end of block
0
1578-
1579/*!-
1580 Returns the default application font.-
1581-
1582 \sa fontMetrics(), QWidget::font()-
1583*/-
1584QFont QApplication::font()-
1585{-
1586 return QGuiApplication::font();
never executed: return QGuiApplication::font();
0
1587}-
1588-
1589/*!-
1590 \overload-
1591-
1592 Returns the default font for the \a widget.-
1593-
1594 \sa fontMetrics(), QWidget::setFont()-
1595*/-
1596-
1597QFont QApplication::font(const QWidget *widget)-
1598{-
1599 typedef FontHash::const_iterator FontHashConstIt;-
1600-
1601 FontHash *hash = app_fonts();-
1602-
1603 if (widget && hash && hash->size()) {
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
hashDescription
TRUEnever evaluated
FALSEnever evaluated
hash->size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1604#ifdef Q_OS_MAC-
1605 // short circuit for small and mini controls-
1606 if (widget->testAttribute(Qt::WA_MacSmallSize)) {-
1607 return hash->value(QByteArrayLiteral("QSmallFont"));-
1608 } else if (widget->testAttribute(Qt::WA_MacMiniSize)) {-
1609 return hash->value(QByteArrayLiteral("QMiniFont"));-
1610 }-
1611#endif-
1612 FontHashConstIt it = hash->constFind(widget->metaObject()->className());-
1613 const FontHashConstIt cend = hash->constEnd();-
1614 if (it != cend)
it != cendDescription
TRUEnever evaluated
FALSEnever evaluated
0
1615 return it.value();
never executed: return it.value();
0
1616 for (it = hash->constBegin(); it != cend; ++it) {
it != cendDescription
TRUEnever evaluated
FALSEnever evaluated
0
1617 if (widget->inherits(it.key()))
widget->inherits(it.key())Description
TRUEnever evaluated
FALSEnever evaluated
0
1618 return it.value();
never executed: return it.value();
0
1619 }
never executed: end of block
0
1620 }
never executed: end of block
0
1621 return font();
never executed: return font();
0
1622}-
1623-
1624/*!-
1625 \overload-
1626-
1627 Returns the font for widgets of the given \a className.-
1628-
1629 \sa setFont(), QWidget::font()-
1630*/-
1631QFont QApplication::font(const char *className)-
1632{-
1633 FontHash *hash = app_fonts();-
1634 if (className && hash && hash->size()) {
classNameDescription
TRUEnever evaluated
FALSEnever evaluated
hashDescription
TRUEnever evaluated
FALSEnever evaluated
hash->size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1635 QHash<QByteArray, QFont>::ConstIterator it = hash->constFind(className);-
1636 if (it != hash->constEnd())
it != hash->constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
0
1637 return *it;
never executed: return *it;
0
1638 }
never executed: end of block
0
1639 return font();
never executed: return font();
0
1640}-
1641-
1642-
1643/*!-
1644 Changes the default application font to \a font. If \a className is passed,-
1645 the change applies only to classes that inherit \a className (as reported-
1646 by QObject::inherits()).-
1647-
1648 On application start-up, the default font depends on the window system. It-
1649 can vary depending on both the window system version and the locale. This-
1650 function lets you override the default font; but overriding may be a bad-
1651 idea because, for example, some locales need extra large fonts to support-
1652 their special characters.-
1653-
1654 \warning Do not use this function in conjunction with \l{Qt Style Sheets}.-
1655 The font of an application can be customized using the "font" style sheet-
1656 property. To set a bold font for all QPushButtons, set the application-
1657 styleSheet() as "QPushButton { font: bold }"-
1658-
1659 \sa font(), fontMetrics(), QWidget::setFont()-
1660*/-
1661-
1662void QApplication::setFont(const QFont &font, const char *className)-
1663{-
1664 bool all = false;-
1665 FontHash *hash = app_fonts();-
1666 if (!className) {
!classNameDescription
TRUEnever evaluated
FALSEnever evaluated
0
1667 QGuiApplication::setFont(font);-
1668 if (hash && hash->size()) {
hashDescription
TRUEnever evaluated
FALSEnever evaluated
hash->size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1669 all = true;-
1670 hash->clear();-
1671 }
never executed: end of block
0
1672 } else if (hash) {
never executed: end of block
hashDescription
TRUEnever evaluated
FALSEnever evaluated
0
1673 hash->insert(className, font);-
1674 }
never executed: end of block
0
1675 if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) {
QApplicationPr...is_app_runningDescription
TRUEnever evaluated
FALSEnever evaluated
!QApplicationP...is_app_closingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1676 // Send ApplicationFontChange to qApp itself, and to the widgets.-
1677 QEvent e(QEvent::ApplicationFontChange);-
1678 QApplication::sendEvent(QApplication::instance(), &e);-
1679-
1680 QWidgetList wids = QApplication::allWidgets();-
1681 for (QWidgetList::ConstIterator it = wids.constBegin(), cend = wids.constEnd(); it != cend; ++it) {
it != cendDescription
TRUEnever evaluated
FALSEnever evaluated
0
1682 QWidget *w = *it;-
1683 if (all || (!className && w->isWindow()) || w->inherits(className)) // matching class
allDescription
TRUEnever evaluated
FALSEnever evaluated
!classNameDescription
TRUEnever evaluated
FALSEnever evaluated
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
w->inherits(className)Description
TRUEnever evaluated
FALSEnever evaluated
0
1684 sendEvent(w, &e);
never executed: sendEvent(w, &e);
0
1685 }
never executed: end of block
0
1686-
1687#ifndef QT_NO_GRAPHICSVIEW-
1688 // Send to all scenes as well.-
1689 QList<QGraphicsScene *> &scenes = qApp->d_func()->scene_list;-
1690 for (QList<QGraphicsScene *>::ConstIterator it = scenes.constBegin();-
1691 it != scenes.constEnd(); ++it) {
it != scenes.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
0
1692 QApplication::sendEvent(*it, &e);-
1693 }
never executed: end of block
0
1694#endif //QT_NO_GRAPHICSVIEW-
1695 }
never executed: end of block
0
1696 if (!className && (!QApplicationPrivate::sys_font || !font.isCopyOf(*QApplicationPrivate::sys_font))) {
!classNameDescription
TRUEnever evaluated
FALSEnever evaluated
!QApplicationPrivate::sys_fontDescription
TRUEnever evaluated
FALSEnever evaluated
!font.isCopyOf...ate::sys_font)Description
TRUEnever evaluated
FALSEnever evaluated
0
1697 if (!QApplicationPrivate::set_font)
!QApplicationPrivate::set_fontDescription
TRUEnever evaluated
FALSEnever evaluated
0
1698 QApplicationPrivate::set_font = new QFont(font);
never executed: QApplicationPrivate::set_font = new QFont(font);
0
1699 else-
1700 *QApplicationPrivate::set_font = font;
never executed: *QApplicationPrivate::set_font = font;
0
1701 }-
1702}
never executed: end of block
0
1703-
1704/*! \internal-
1705*/-
1706void QApplicationPrivate::setSystemFont(const QFont &font)-
1707{-
1708 if (!sys_font)
!sys_fontDescription
TRUEnever evaluated
FALSEnever evaluated
0
1709 sys_font = new QFont(font);
never executed: sys_font = new QFont(font);
0
1710 else-
1711 *sys_font = font;
never executed: *sys_font = font;
0
1712-
1713 if (!QApplicationPrivate::set_font)
!QApplicationPrivate::set_fontDescription
TRUEnever evaluated
FALSEnever evaluated
0
1714 QApplication::setFont(*sys_font);
never executed: QApplication::setFont(*sys_font);
0
1715}
never executed: end of block
0
1716-
1717/*! \internal-
1718*/-
1719QString QApplicationPrivate::desktopStyleKey()-
1720{-
1721 // The platform theme might return a style that is not available, find-
1722 // first valid one.-
1723 if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
const QPlatfor...latformTheme()Description
TRUEnever evaluated
FALSEnever evaluated
0
1724 const QStringList availableKeys = QStyleFactory::keys();-
1725 const auto styles = theme->themeHint(QPlatformTheme::StyleNames).toStringList();-
1726 for (const QString &style : styles) {-
1727 if (availableKeys.contains(style, Qt::CaseInsensitive))
availableKeys....seInsensitive)Description
TRUEnever evaluated
FALSEnever evaluated
0
1728 return style;
never executed: return style;
0
1729 }
never executed: end of block
0
1730 }
never executed: end of block
0
1731 return QString();
never executed: return QString();
0
1732}-
1733-
1734#if QT_VERSION < 0x060000 // remove these forwarders in Qt 6-
1735/*!-
1736 \property QApplication::windowIcon-
1737 \brief the default window icon-
1738-
1739 \sa QWidget::setWindowIcon(), {Setting the Application Icon}-
1740*/-
1741QIcon QApplication::windowIcon()-
1742{-
1743 return QGuiApplication::windowIcon();
never executed: return QGuiApplication::windowIcon();
0
1744}-
1745-
1746void QApplication::setWindowIcon(const QIcon &icon)-
1747{-
1748 QGuiApplication::setWindowIcon(icon);-
1749}
never executed: end of block
0
1750#endif-
1751-
1752void QApplicationPrivate::notifyWindowIconChanged()-
1753{-
1754 QEvent ev(QEvent::ApplicationWindowIconChange);-
1755 const QWidgetList list = QApplication::topLevelWidgets();-
1756 QWindowList windowList = QGuiApplication::topLevelWindows();-
1757-
1758 // send to all top-level QWidgets-
1759 for (auto *w : list) {-
1760 windowList.removeOne(w->windowHandle());-
1761 QCoreApplication::sendEvent(w, &ev);-
1762 }
never executed: end of block
0
1763-
1764 // in case there are any plain QWindows in this QApplication-using-
1765 // application, also send the notification to them-
1766 for (int i = 0; i < windowList.size(); ++i)
i < windowList.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
1767 QCoreApplication::sendEvent(windowList.at(i), &ev);
never executed: QCoreApplication::sendEvent(windowList.at(i), &ev);
0
1768}
never executed: end of block
0
1769-
1770/*!-
1771 Returns a list of the top-level widgets (windows) in the application.-
1772-
1773 \note Some of the top-level widgets may be hidden, for example a tooltip if-
1774 no tooltip is currently shown.-
1775-
1776 Example:-
1777-
1778 \snippet code/src_gui_kernel_qapplication.cpp 4-
1779-
1780 \sa allWidgets(), QWidget::isWindow(), QWidget::isHidden()-
1781*/-
1782QWidgetList QApplication::topLevelWidgets()-
1783{-
1784 QWidgetList list;-
1785 QWidgetList all = allWidgets();-
1786-
1787 for (QWidgetList::ConstIterator it = all.constBegin(), cend = all.constEnd(); it != cend; ++it) {
it != cendDescription
TRUEnever evaluated
FALSEnever evaluated
0
1788 QWidget *w = *it;-
1789 if (w->isWindow() && w->windowType() != Qt::Desktop)
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
w->windowType() != Qt::DesktopDescription
TRUEnever evaluated
FALSEnever evaluated
0
1790 list.append(w);
never executed: list.append(w);
0
1791 }
never executed: end of block
0
1792 return list;
never executed: return list;
0
1793}-
1794-
1795/*!-
1796 Returns a list of all the widgets in the application.-
1797-
1798 The list is empty (QList::isEmpty()) if there are no widgets.-
1799-
1800 \note Some of the widgets may be hidden.-
1801-
1802 Example:-
1803 \snippet code/src_gui_kernel_qapplication.cpp 5-
1804-
1805 \sa topLevelWidgets(), QWidget::isVisible()-
1806*/-
1807-
1808QWidgetList QApplication::allWidgets()-
1809{-
1810 if (QWidgetPrivate::allWidgets)
QWidgetPrivate::allWidgetsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1811 return QWidgetPrivate::allWidgets->toList();
never executed: return QWidgetPrivate::allWidgets->toList();
0
1812 return QWidgetList();
never executed: return QWidgetList();
0
1813}-
1814-
1815/*!-
1816 Returns the application widget that has the keyboard input focus, or 0 if-
1817 no widget in this application has the focus.-
1818-
1819 \sa QWidget::setFocus(), QWidget::hasFocus(), activeWindow(), focusChanged()-
1820*/-
1821-
1822QWidget *QApplication::focusWidget()-
1823{-
1824 return QApplicationPrivate::focus_widget;
never executed: return QApplicationPrivate::focus_widget;
0
1825}-
1826-
1827void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)-
1828{-
1829#ifndef QT_NO_GRAPHICSVIEW-
1830 if (focus && focus->window()->graphicsProxyWidget())
focusDescription
TRUEnever evaluated
FALSEnever evaluated
focus->window(...sProxyWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
1831 return;
never executed: return;
0
1832#endif-
1833-
1834 hidden_focus_widget = 0;-
1835-
1836 if (focus != focus_widget) {
focus != focus_widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
1837 if (focus && focus->isHidden()) {
focusDescription
TRUEnever evaluated
FALSEnever evaluated
focus->isHidden()Description
TRUEnever evaluated
FALSEnever evaluated
0
1838 hidden_focus_widget = focus;-
1839 return;
never executed: return;
0
1840 }-
1841-
1842 if (focus && (reason == Qt::BacktabFocusReason || reason == Qt::TabFocusReason)
focusDescription
TRUEnever evaluated
FALSEnever evaluated
reason == Qt::...tabFocusReasonDescription
TRUEnever evaluated
FALSEnever evaluated
reason == Qt::TabFocusReasonDescription
TRUEnever evaluated
FALSEnever evaluated
0
1843 && qt_in_tab_key_event)
qt_in_tab_key_eventDescription
TRUEnever evaluated
FALSEnever evaluated
0
1844 focus->window()->setAttribute(Qt::WA_KeyboardFocusChange);
never executed: focus->window()->setAttribute(Qt::WA_KeyboardFocusChange);
0
1845 else if (focus && reason == Qt::ShortcutFocusReason) {
focusDescription
TRUEnever evaluated
FALSEnever evaluated
reason == Qt::...cutFocusReasonDescription
TRUEnever evaluated
FALSEnever evaluated
0
1846 focus->window()->setAttribute(Qt::WA_KeyboardFocusChange);-
1847 }
never executed: end of block
0
1848 QWidget *prev = focus_widget;-
1849 focus_widget = focus;-
1850-
1851 if(focus_widget)
focus_widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
1852 focus_widget->d_func()->setFocus_sys();
never executed: focus_widget->d_func()->setFocus_sys();
0
1853-
1854 if (reason != Qt::NoFocusReason) {
reason != Qt::NoFocusReasonDescription
TRUEnever evaluated
FALSEnever evaluated
0
1855-
1856 //send events-
1857 if (prev) {
prevDescription
TRUEnever evaluated
FALSEnever evaluated
0
1858#ifdef QT_KEYPAD_NAVIGATION-
1859 if (QApplication::keypadNavigationEnabled()) {-
1860 if (prev->hasEditFocus() && reason != Qt::PopupFocusReason)-
1861 prev->setEditFocus(false);-
1862 }-
1863#endif-
1864 QFocusEvent out(QEvent::FocusOut, reason);-
1865 QPointer<QWidget> that = prev;-
1866 QApplication::sendEvent(prev, &out);-
1867 if (that)
thatDescription
TRUEnever evaluated
FALSEnever evaluated
0
1868 QApplication::sendEvent(that->style(), &out);
never executed: QApplication::sendEvent(that->style(), &out);
0
1869 }
never executed: end of block
0
1870 if(focus && QApplicationPrivate::focus_widget == focus) {
focusDescription
TRUEnever evaluated
FALSEnever evaluated
QApplicationPr...idget == focusDescription
TRUEnever evaluated
FALSEnever evaluated
0
1871 QFocusEvent in(QEvent::FocusIn, reason);-
1872 QPointer<QWidget> that = focus;-
1873 QApplication::sendEvent(focus, &in);-
1874 if (that)
thatDescription
TRUEnever evaluated
FALSEnever evaluated
0
1875 QApplication::sendEvent(that->style(), &in);
never executed: QApplication::sendEvent(that->style(), &in);
0
1876 }
never executed: end of block
0
1877 emit qApp->focusChanged(prev, focus_widget);-
1878 }
never executed: end of block
0
1879 }
never executed: end of block
0
1880}
never executed: end of block
0
1881-
1882-
1883/*!-
1884 Returns the application top-level window that has the keyboard input focus,-
1885 or 0 if no application window has the focus. There might be an-
1886 activeWindow() even if there is no focusWidget(), for example if no widget-
1887 in that window accepts key events.-
1888-
1889 \sa QWidget::setFocus(), QWidget::hasFocus(), focusWidget()-
1890*/-
1891-
1892QWidget *QApplication::activeWindow()-
1893{-
1894 return QApplicationPrivate::active_window;
never executed: return QApplicationPrivate::active_window;
0
1895}-
1896-
1897/*!-
1898 Returns display (screen) font metrics for the application font.-
1899-
1900 \sa font(), setFont(), QWidget::fontMetrics(), QPainter::fontMetrics()-
1901*/-
1902-
1903QFontMetrics QApplication::fontMetrics()-
1904{-
1905 return desktop()->fontMetrics();
never executed: return desktop()->fontMetrics();
0
1906}-
1907-
1908bool QApplicationPrivate::tryCloseAllWidgetWindows(QWindowList *processedWindows)-
1909{-
1910 Q_ASSERT(processedWindows);-
1911 while (QWidget *w = QApplication::activeModalWidget()) {
QWidget *w = Q...eModalWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
1912 if (!w->isVisible() || w->data->is_closing)
!w->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
w->data->is_closingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1913 break;
never executed: break;
0
1914 QWindow *window = w->windowHandle();-
1915 if (!window->close()) // Qt::WA_DeleteOnClose may cause deletion.
!window->close()Description
TRUEnever evaluated
FALSEnever evaluated
0
1916 return false;
never executed: return false;
0
1917 if (window)
windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
1918 processedWindows->append(window);
never executed: processedWindows->append(window);
0
1919 }
never executed: end of block
0
1920-
1921retry:
code before this statement never executed: retry:
0
1922 const QWidgetList list = QApplication::topLevelWidgets();-
1923 for (auto *w : list) {-
1924 if (w->isVisible() && w->windowType() != Qt::Desktop &&
w->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
w->windowType() != Qt::DesktopDescription
TRUEnever evaluated
FALSEnever evaluated
0
1925 !w->testAttribute(Qt::WA_DontShowOnScreen) && !w->data->is_closing) {
!w->testAttrib...tShowOnScreen)Description
TRUEnever evaluated
FALSEnever evaluated
!w->data->is_closingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1926 QWindow *window = w->windowHandle();-
1927 if (!window->close()) // Qt::WA_DeleteOnClose may cause deletion.
!window->close()Description
TRUEnever evaluated
FALSEnever evaluated
0
1928 return false;
never executed: return false;
0
1929 if (window)
windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
1930 processedWindows->append(window);
never executed: processedWindows->append(window);
0
1931 goto retry;
never executed: goto retry;
0
1932 }-
1933 }
never executed: end of block
0
1934 return true;
never executed: return true;
0
1935}-
1936-
1937bool QApplicationPrivate::tryCloseAllWindows()-
1938{-
1939 QWindowList processedWindows;-
1940 return QApplicationPrivate::tryCloseAllWidgetWindows(&processedWindows)
never executed: return QApplicationPrivate::tryCloseAllWidgetWindows(&processedWindows) && QGuiApplicationPrivate::tryCloseRemainingWindows(processedWindows);
0
1941 && QGuiApplicationPrivate::tryCloseRemainingWindows(processedWindows);
never executed: return QApplicationPrivate::tryCloseAllWidgetWindows(&processedWindows) && QGuiApplicationPrivate::tryCloseRemainingWindows(processedWindows);
0
1942}-
1943-
1944/*!-
1945 Closes all top-level windows.-
1946-
1947 This function is particularly useful for applications with many top-level-
1948 windows. It could, for example, be connected to a \uicontrol{Exit} entry in the-
1949 \uicontrol{File} menu:-
1950-
1951 \snippet mainwindows/mdi/mainwindow.cpp 0-
1952-
1953 The windows are closed in random order, until one window does not accept-
1954 the close event. The application quits when the last window was-
1955 successfully closed; this can be turned off by setting-
1956 \l quitOnLastWindowClosed to false.-
1957-
1958 \sa quitOnLastWindowClosed, lastWindowClosed(), QWidget::close(),-
1959 QWidget::closeEvent(), lastWindowClosed(), QCoreApplication::quit(), topLevelWidgets(),-
1960 QWidget::isWindow()-
1961*/-
1962void QApplication::closeAllWindows()-
1963{-
1964 QWindowList processedWindows;-
1965 QApplicationPrivate::tryCloseAllWidgetWindows(&processedWindows);-
1966}
never executed: end of block
0
1967-
1968/*!-
1969 Displays a simple message box about Qt. The message includes the version-
1970 number of Qt being used by the application.-
1971-
1972 This is useful for inclusion in the \uicontrol Help menu of an application, as-
1973 shown in the \l{mainwindows/menus}{Menus} example.-
1974-
1975 This function is a convenience slot for QMessageBox::aboutQt().-
1976*/-
1977void QApplication::aboutQt()-
1978{-
1979#ifndef QT_NO_MESSAGEBOX-
1980 QMessageBox::aboutQt(activeWindow());-
1981#endif // QT_NO_MESSAGEBOX-
1982}
never executed: end of block
0
1983-
1984/*!-
1985 \since 4.1-
1986 \fn void QApplication::focusChanged(QWidget *old, QWidget *now)-
1987-
1988 This signal is emitted when the widget that has keyboard focus changed from-
1989 \a old to \a now, i.e., because the user pressed the tab-key, clicked into-
1990 a widget or changed the active window. Both \a old and \a now can be the-
1991 null-pointer.-
1992-
1993 The signal is emitted after both widget have been notified about the change-
1994 through QFocusEvent.-
1995-
1996 \sa QWidget::setFocus(), QWidget::clearFocus(), Qt::FocusReason-
1997*/-
1998-
1999/*!\reimp-
2000-
2001*/-
2002bool QApplication::event(QEvent *e)-
2003{-
2004 Q_D(QApplication);-
2005 if(e->type() == QEvent::Close) {
e->type() == QEvent::CloseDescription
TRUEnever evaluated
FALSEnever evaluated
0
2006 QCloseEvent *ce = static_cast<QCloseEvent*>(e);-
2007 ce->accept();-
2008 closeAllWindows();-
2009-
2010 const QWidgetList list = topLevelWidgets();-
2011 for (auto *w : list) {-
2012 if (w->isVisible() && !(w->windowType() == Qt::Desktop) && !(w->windowType() == Qt::Popup) &&
w->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
!(w->windowTyp...= Qt::Desktop)Description
TRUEnever evaluated
FALSEnever evaluated
!(w->windowTyp... == Qt::Popup)Description
TRUEnever evaluated
FALSEnever evaluated
0
2013 (!(w->windowType() == Qt::Dialog) || !w->parentWidget())) {
!(w->windowTyp...== Qt::Dialog)Description
TRUEnever evaluated
FALSEnever evaluated
!w->parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
2014 ce->ignore();-
2015 break;
never executed: break;
0
2016 }-
2017 }
never executed: end of block
0
2018 if (ce->isAccepted()) {
ce->isAccepted()Description
TRUEnever evaluated
FALSEnever evaluated
0
2019 return true;
never executed: return true;
0
2020 }-
2021#ifndef Q_OS_WIN-
2022 } else if (e->type() == QEvent::LocaleChange) {
never executed: end of block
e->type() == Q...::LocaleChangeDescription
TRUEnever evaluated
FALSEnever evaluated
0
2023 // on Windows the event propagation is taken care by the-
2024 // WM_SETTINGCHANGE event handler.-
2025 const QWidgetList list = topLevelWidgets();-
2026 for (auto *w : list) {-
2027 if (!(w->windowType() == Qt::Desktop)) {
!(w->windowTyp...= Qt::Desktop)Description
TRUEnever evaluated
FALSEnever evaluated
0
2028 if (!w->testAttribute(Qt::WA_SetLocale))
!w->testAttrib...:WA_SetLocale)Description
TRUEnever evaluated
FALSEnever evaluated
0
2029 w->d_func()->setLocale_helper(QLocale(), true);
never executed: w->d_func()->setLocale_helper(QLocale(), true);
0
2030 }
never executed: end of block
0
2031 }
never executed: end of block
0
2032#endif-
2033 } else if (e->type() == QEvent::Timer) {
never executed: end of block
e->type() == QEvent::TimerDescription
TRUEnever evaluated
FALSEnever evaluated
0
2034 QTimerEvent *te = static_cast<QTimerEvent*>(e);-
2035 Q_ASSERT(te != 0);-
2036 if (te->timerId() == d->toolTipWakeUp.timerId()) {
te->timerId() ...keUp.timerId()Description
TRUEnever evaluated
FALSEnever evaluated
0
2037 d->toolTipWakeUp.stop();-
2038 if (d->toolTipWidget) {
d->toolTipWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
2039 QWidget *w = d->toolTipWidget->window();-
2040 // show tooltip if WA_AlwaysShowToolTips is set, or if-
2041 // any ancestor of d->toolTipWidget is the active-
2042 // window-
2043 bool showToolTip = w->testAttribute(Qt::WA_AlwaysShowToolTips);-
2044 while (w && !showToolTip) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
!showToolTipDescription
TRUEnever evaluated
FALSEnever evaluated
0
2045 showToolTip = w->isActiveWindow();-
2046 w = w->parentWidget();-
2047 w = w ? w->window() : 0;
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
2048 }
never executed: end of block
0
2049 if (showToolTip) {
showToolTipDescription
TRUEnever evaluated
FALSEnever evaluated
0
2050 QHelpEvent e(QEvent::ToolTip, d->toolTipPos, d->toolTipGlobalPos);-
2051 QApplication::sendEvent(d->toolTipWidget, &e);-
2052 if (e.isAccepted()) {
e.isAccepted()Description
TRUEnever evaluated
FALSEnever evaluated
0
2053 QStyle *s = d->toolTipWidget->style();-
2054 int sleepDelay = s->styleHint(QStyle::SH_ToolTip_FallAsleepDelay, 0, d->toolTipWidget, 0);-
2055 d->toolTipFallAsleep.start(sleepDelay, this);-
2056 }
never executed: end of block
0
2057 }
never executed: end of block
0
2058 }
never executed: end of block
0
2059 } else if (te->timerId() == d->toolTipFallAsleep.timerId()) {
never executed: end of block
te->timerId() ...leep.timerId()Description
TRUEnever evaluated
FALSEnever evaluated
0
2060 d->toolTipFallAsleep.stop();-
2061 }
never executed: end of block
0
2062#ifndef QT_NO_WHATSTHIS-
2063 } else if (e->type() == QEvent::EnterWhatsThisMode) {
never executed: end of block
e->type() == Q...rWhatsThisModeDescription
TRUEnever evaluated
FALSEnever evaluated
0
2064 QWhatsThis::enterWhatsThisMode();-
2065 return true;
never executed: return true;
0
2066#endif-
2067 }-
2068-
2069 if(e->type() == QEvent::LanguageChange) {
e->type() == Q...LanguageChangeDescription
TRUEnever evaluated
FALSEnever evaluated
0
2070 const QWidgetList list = topLevelWidgets();-
2071 for (auto *w : list) {-
2072 if (!(w->windowType() == Qt::Desktop))
!(w->windowTyp...= Qt::Desktop)Description
TRUEnever evaluated
FALSEnever evaluated
0
2073 postEvent(w, new QEvent(QEvent::LanguageChange));
never executed: postEvent(w, new QEvent(QEvent::LanguageChange));
0
2074 }
never executed: end of block
0
2075 }
never executed: end of block
0
2076-
2077 return QGuiApplication::event(e);
never executed: return QGuiApplication::event(e);
0
2078}-
2079-
2080/*!-
2081 \fn void QApplication::syncX()-
2082 Was used to synchronize with the X server in 4.x, here for source compatibility.-
2083 \internal-
2084 \obsolete-
2085*/-
2086-
2087// ### FIXME: topLevelWindows does not contain QWidgets without a parent-
2088// until create_sys is called. So we have to override the-
2089// QGuiApplication::notifyLayoutDirectionChange-
2090// to do the right thing.-
2091void QApplicationPrivate::notifyLayoutDirectionChange()-
2092{-
2093 const QWidgetList list = QApplication::topLevelWidgets();-
2094 QWindowList windowList = QGuiApplication::topLevelWindows();-
2095-
2096 // send to all top-level QWidgets-
2097 for (auto *w : list) {-
2098 windowList.removeAll(w->windowHandle());-
2099 QEvent ev(QEvent::ApplicationLayoutDirectionChange);-
2100 QCoreApplication::sendEvent(w, &ev);-
2101 }
never executed: end of block
0
2102-
2103 // in case there are any plain QWindows in this QApplication-using-
2104 // application, also send the notification to them-
2105 for (int i = 0; i < windowList.size(); ++i) {
i < windowList.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
2106 QEvent ev(QEvent::ApplicationLayoutDirectionChange);-
2107 QCoreApplication::sendEvent(windowList.at(i), &ev);-
2108 }
never executed: end of block
0
2109}
never executed: end of block
0
2110-
2111/*!-
2112 \fn void QApplication::setActiveWindow(QWidget* active)-
2113-
2114 Sets the active window to the \a active widget in response to a system-
2115 event. The function is called from the platform specific event handlers.-
2116-
2117 \warning This function does \e not set the keyboard focus to the active-
2118 widget. Call QWidget::activateWindow() instead.-
2119-
2120 It sets the activeWindow() and focusWidget() attributes and sends proper-
2121 \l{QEvent::WindowActivate}{WindowActivate}/\l{QEvent::WindowDeactivate}-
2122 {WindowDeactivate} and \l{QEvent::FocusIn}{FocusIn}/\l{QEvent::FocusOut}-
2123 {FocusOut} events to all appropriate widgets. The window will then be-
2124 painted in active state (e.g. cursors in line edits will blink), and it-
2125 will have tool tips enabled.-
2126-
2127 \sa activeWindow(), QWidget::activateWindow()-
2128*/-
2129void QApplication::setActiveWindow(QWidget* act)-
2130{-
2131 QWidget* window = act?act->window():0;
actDescription
TRUEnever evaluated
FALSEnever evaluated
0
2132-
2133 if (QApplicationPrivate::active_window == window)
QApplicationPr...ndow == windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2134 return;
never executed: return;
0
2135-
2136#ifndef QT_NO_GRAPHICSVIEW-
2137 if (window && window->graphicsProxyWidget()) {
windowDescription
TRUEnever evaluated
FALSEnever evaluated
window->graphicsProxyWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
2138 // Activate the proxy's view->viewport() ?-
2139 return;
never executed: return;
0
2140 }-
2141#endif-
2142-
2143 QWidgetList toBeActivated;-
2144 QWidgetList toBeDeactivated;-
2145-
2146 if (QApplicationPrivate::active_window) {
QApplicationPr...:active_windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2147 if (style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, QApplicationPrivate::active_window)) {
style()->style...active_window)Description
TRUEnever evaluated
FALSEnever evaluated
0
2148 const QWidgetList list = topLevelWidgets();-
2149 for (auto *w : list) {-
2150 if (w->isVisible() && w->isActiveWindow())
w->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
w->isActiveWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
2151 toBeDeactivated.append(w);
never executed: toBeDeactivated.append(w);
0
2152 }
never executed: end of block
0
2153 } else {
never executed: end of block
0
2154 toBeDeactivated.append(QApplicationPrivate::active_window);-
2155 }
never executed: end of block
0
2156 }-
2157-
2158 if (QApplicationPrivate::focus_widget) {
QApplicationPr...::focus_widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
2159 if (QApplicationPrivate::focus_widget->testAttribute(Qt::WA_InputMethodEnabled))
QApplicationPr...MethodEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
0
2160 QGuiApplication::inputMethod()->commit();
never executed: QGuiApplication::inputMethod()->commit();
0
2161-
2162 QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange, Qt::ActiveWindowFocusReason);-
2163 QApplication::sendEvent(QApplicationPrivate::focus_widget, &focusAboutToChange);-
2164 }
never executed: end of block
0
2165-
2166 QApplicationPrivate::active_window = window;-
2167-
2168 if (QApplicationPrivate::active_window) {
QApplicationPr...:active_windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2169 if (style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, QApplicationPrivate::active_window)) {
style()->style...active_window)Description
TRUEnever evaluated
FALSEnever evaluated
0
2170 const QWidgetList list = topLevelWidgets();-
2171 for (auto *w : list) {-
2172 if (w->isVisible() && w->isActiveWindow())
w->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
w->isActiveWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
2173 toBeActivated.append(w);
never executed: toBeActivated.append(w);
0
2174 }
never executed: end of block
0
2175 } else {
never executed: end of block
0
2176 toBeActivated.append(QApplicationPrivate::active_window);-
2177 }
never executed: end of block
0
2178-
2179 }-
2180-
2181 // first the activation/deactivation events-
2182 QEvent activationChange(QEvent::ActivationChange);-
2183 QEvent windowActivate(QEvent::WindowActivate);-
2184 QEvent windowDeactivate(QEvent::WindowDeactivate);-
2185-
2186 for (int i = 0; i < toBeActivated.size(); ++i) {
i < toBeActivated.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
2187 QWidget *w = toBeActivated.at(i);-
2188 sendSpontaneousEvent(w, &windowActivate);-
2189 sendSpontaneousEvent(w, &activationChange);-
2190 }
never executed: end of block
0
2191-
2192 for(int i = 0; i < toBeDeactivated.size(); ++i) {
i < toBeDeactivated.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
2193 QWidget *w = toBeDeactivated.at(i);-
2194 sendSpontaneousEvent(w, &windowDeactivate);-
2195 sendSpontaneousEvent(w, &activationChange);-
2196 }
never executed: end of block
0
2197-
2198 if (QApplicationPrivate::popupWidgets == 0) { // !inPopupMode()
QApplicationPr...upWidgets == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2199 // then focus events-
2200 if (!QApplicationPrivate::active_window && QApplicationPrivate::focus_widget) {
!QApplicationP...:active_windowDescription
TRUEnever evaluated
FALSEnever evaluated
QApplicationPr...::focus_widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
2201 QApplicationPrivate::setFocusWidget(0, Qt::ActiveWindowFocusReason);-
2202 } else if (QApplicationPrivate::active_window) {
never executed: end of block
QApplicationPr...:active_windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2203 QWidget *w = QApplicationPrivate::active_window->focusWidget();-
2204 if (w && w->isVisible() /*&& w->focusPolicy() != QWidget::NoFocus*/)
wDescription
TRUEnever evaluated
FALSEnever evaluated
w->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
0
2205 w->setFocus(Qt::ActiveWindowFocusReason);
never executed: w->setFocus(Qt::ActiveWindowFocusReason);
0
2206 else {-
2207 w = QApplicationPrivate::focusNextPrevChild_helper(QApplicationPrivate::active_window, true);-
2208 if (w) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
2209 w->setFocus(Qt::ActiveWindowFocusReason);-
2210 } else {
never executed: end of block
0
2211 // If the focus widget is not in the activate_window, clear the focus-
2212 w = QApplicationPrivate::focus_widget;-
2213 if (!w && QApplicationPrivate::active_window->focusPolicy() != Qt::NoFocus)
!wDescription
TRUEnever evaluated
FALSEnever evaluated
QApplicationPr...!= Qt::NoFocusDescription
TRUEnever evaluated
FALSEnever evaluated
0
2214 QApplicationPrivate::setFocusWidget(QApplicationPrivate::active_window, Qt::ActiveWindowFocusReason);
never executed: QApplicationPrivate::setFocusWidget(QApplicationPrivate::active_window, Qt::ActiveWindowFocusReason);
0
2215 else if (!QApplicationPrivate::active_window->isAncestorOf(w))
!QApplicationP...sAncestorOf(w)Description
TRUEnever evaluated
FALSEnever evaluated
0
2216 QApplicationPrivate::setFocusWidget(0, Qt::ActiveWindowFocusReason);
never executed: QApplicationPrivate::setFocusWidget(0, Qt::ActiveWindowFocusReason);
0
2217 }
never executed: end of block
0
2218 }-
2219 }-
2220 }
never executed: end of block
0
2221}
never executed: end of block
0
2222-
2223QWidget *qt_tlw_for_window(QWindow *wnd)-
2224{-
2225 // QTBUG-32177, wnd might be a QQuickView embedded via window container.-
2226 while (wnd && !wnd->isTopLevel()) {
wndDescription
TRUEnever evaluated
FALSEnever evaluated
!wnd->isTopLevel()Description
TRUEnever evaluated
FALSEnever evaluated
0
2227 QWindow *parent = wnd->parent();-
2228 // Don't end up in windows not belonging to this application-
2229 if (parent && parent->type() != Qt::ForeignWindow)
parentDescription
TRUEnever evaluated
FALSEnever evaluated
parent->type()...:ForeignWindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2230 wnd = wnd->parent();
never executed: wnd = wnd->parent();
0
2231 else-
2232 break;
never executed: break;
0
2233 }-
2234 if (wnd) {
wndDescription
TRUEnever evaluated
FALSEnever evaluated
0
2235 const auto tlws = qApp->topLevelWidgets();-
2236 for (QWidget *tlw : tlws) {-
2237 if (tlw->windowHandle() == wnd)
tlw->windowHandle() == wndDescription
TRUEnever evaluated
FALSEnever evaluated
0
2238 return tlw;
never executed: return tlw;
0
2239 }
never executed: end of block
0
2240 }
never executed: end of block
0
2241 return 0;
never executed: return 0;
0
2242}-
2243-
2244void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous)-
2245{-
2246 Q_UNUSED(previous);-
2247 QWindow *wnd = QGuiApplicationPrivate::focus_window;-
2248 if (inPopupMode()) // some delayed focus event to ignore
inPopupMode()Description
TRUEnever evaluated
FALSEnever evaluated
0
2249 return;
never executed: return;
0
2250 QWidget *tlw = qt_tlw_for_window(wnd);-
2251 QApplication::setActiveWindow(tlw);-
2252 // QTBUG-37126, Active X controls may set the focus on native child widgets.-
2253 if (wnd && tlw && wnd != tlw->windowHandle()) {
wndDescription
TRUEnever evaluated
FALSEnever evaluated
tlwDescription
TRUEnever evaluated
FALSEnever evaluated
wnd != tlw->windowHandle()Description
TRUEnever evaluated
FALSEnever evaluated
0
2254 if (QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(wnd))
QWidgetWindow ...Window *>(wnd)Description
TRUEnever evaluated
FALSEnever evaluated
0
2255 if (QWidget *widget = widgetWindow->widget())
QWidget *widge...ndow->widget()Description
TRUEnever evaluated
FALSEnever evaluated
0
2256 if (widget->inherits("QAxHostWidget"))
widget->inheri...AxHostWidget")Description
TRUEnever evaluated
FALSEnever evaluated
0
2257 widget->setFocus(Qt::ActiveWindowFocusReason);
never executed: widget->setFocus(Qt::ActiveWindowFocusReason);
0
2258 }
never executed: end of block
0
2259}
never executed: end of block
0
2260-
2261/*!internal-
2262 * Helper function that returns the new focus widget, but does not set the focus reason.-
2263 * Returns 0 if a new focus widget could not be found.-
2264 * Shared with QGraphicsProxyWidgetPrivate::findFocusChild()-
2265*/-
2266QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool next,-
2267 bool *wrappingOccurred)-
2268{-
2269 uint focus_flag = qt_tab_all_widgets() ? Qt::TabFocus : Qt::StrongFocus;
qt_tab_all_widgets()Description
TRUEnever evaluated
FALSEnever evaluated
0
2270-
2271 QWidget *f = toplevel->focusWidget();-
2272 if (!f)
!fDescription
TRUEnever evaluated
FALSEnever evaluated
0
2273 f = toplevel;
never executed: f = toplevel;
0
2274-
2275 QWidget *w = f;-
2276 QWidget *test = f->d_func()->focus_next;-
2277 bool seenWindow = false;-
2278 bool focusWidgetAfterWindow = false;-
2279 while (test && test != f) {
testDescription
TRUEnever evaluated
FALSEnever evaluated
test != fDescription
TRUEnever evaluated
FALSEnever evaluated
0
2280 if (test->isWindow())
test->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
2281 seenWindow = true;
never executed: seenWindow = true;
0
2282-
2283 if ((test->focusPolicy() & focus_flag) == focus_flag
(test->focusPo... == focus_flagDescription
TRUEnever evaluated
FALSEnever evaluated
0
2284 && !(test->d_func()->extra && test->d_func()->extra->focus_proxy)
test->d_func()->extraDescription
TRUEnever evaluated
FALSEnever evaluated
test->d_func()...a->focus_proxyDescription
TRUEnever evaluated
FALSEnever evaluated
0
2285 && test->isVisibleTo(toplevel) && test->isEnabled()
test->isVisibleTo(toplevel)Description
TRUEnever evaluated
FALSEnever evaluated
test->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
0
2286 && !(w->windowType() == Qt::SubWindow && !w->isAncestorOf(test))
w->windowType(... Qt::SubWindowDescription
TRUEnever evaluated
FALSEnever evaluated
!w->isAncestorOf(test)Description
TRUEnever evaluated
FALSEnever evaluated
0
2287 && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))) {
toplevel->wind... Qt::SubWindowDescription
TRUEnever evaluated
FALSEnever evaluated
toplevel->isAncestorOf(test)Description
TRUEnever evaluated
FALSEnever evaluated
0
2288 w = test;-
2289 if (seenWindow)
seenWindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2290 focusWidgetAfterWindow = true;
never executed: focusWidgetAfterWindow = true;
0
2291 if (next)
nextDescription
TRUEnever evaluated
FALSEnever evaluated
0
2292 break;
never executed: break;
0
2293 }
never executed: end of block
0
2294 test = test->d_func()->focus_next;-
2295 }
never executed: end of block
0
2296-
2297 if (wrappingOccurred != 0)
wrappingOccurred != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2298 *wrappingOccurred = next ? focusWidgetAfterWindow : !focusWidgetAfterWindow;
never executed: *wrappingOccurred = next ? focusWidgetAfterWindow : !focusWidgetAfterWindow;
nextDescription
TRUEnever evaluated
FALSEnever evaluated
0
2299-
2300 if (w == f) {
w == fDescription
TRUEnever evaluated
FALSEnever evaluated
0
2301 if (qt_in_tab_key_event) {
qt_in_tab_key_eventDescription
TRUEnever evaluated
FALSEnever evaluated
0
2302 w->window()->setAttribute(Qt::WA_KeyboardFocusChange);-
2303 w->update();-
2304 }
never executed: end of block
0
2305 return 0;
never executed: return 0;
0
2306 }-
2307 return w;
never executed: return w;
0
2308}-
2309-
2310/*!-
2311 \fn void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, const QPointF &globalPosF)-
2312 \internal-
2313-
2314 Creates the proper Enter/Leave event when widget \a enter is entered and-
2315 widget \a leave is left.-
2316 */-
2317void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, const QPointF &globalPosF)-
2318{-
2319#if 0-
2320 if (leave) {-
2321 QEvent e(QEvent::Leave);-
2322 QApplication::sendEvent(leave, & e);-
2323 }-
2324 if (enter) {-
2325 const QPoint windowPos = enter->window()->mapFromGlobal(globalPos);-
2326 QEnterEvent e(enter->mapFromGlobal(globalPos), windowPos, globalPos);-
2327 QApplication::sendEvent(enter, & e);-
2328 }-
2329 return;-
2330#endif-
2331-
2332 if ((!enter && !leave) || (enter == leave))
!enterDescription
TRUEnever evaluated
FALSEnever evaluated
!leaveDescription
TRUEnever evaluated
FALSEnever evaluated
(enter == leave)Description
TRUEnever evaluated
FALSEnever evaluated
0
2333 return;
never executed: return;
0
2334#ifdef ALIEN_DEBUG-
2335 qDebug() << "QApplicationPrivate::dispatchEnterLeave, ENTER:" << enter << "LEAVE:" << leave;-
2336#endif-
2337 QWidgetList leaveList;-
2338 QWidgetList enterList;-
2339-
2340 bool sameWindow = leave && enter && leave->window() == enter->window();
leaveDescription
TRUEnever evaluated
FALSEnever evaluated
enterDescription
TRUEnever evaluated
FALSEnever evaluated
leave->window(...nter->window()Description
TRUEnever evaluated
FALSEnever evaluated
0
2341 if (leave && !sameWindow) {
leaveDescription
TRUEnever evaluated
FALSEnever evaluated
!sameWindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2342 auto *w = leave;-
2343 do {-
2344 leaveList.append(w);-
2345 } while (!w->isWindow() && (w = w->parentWidget()));
never executed: end of block
!w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
(w = w->parentWidget())Description
TRUEnever evaluated
FALSEnever evaluated
0
2346 }
never executed: end of block
0
2347 if (enter && !sameWindow) {
enterDescription
TRUEnever evaluated
FALSEnever evaluated
!sameWindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2348 auto *w = enter;-
2349 do {-
2350 enterList.append(w);-
2351 } while (!w->isWindow() && (w = w->parentWidget()));
never executed: end of block
!w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
(w = w->parentWidget())Description
TRUEnever evaluated
FALSEnever evaluated
0
2352 }
never executed: end of block
0
2353 if (sameWindow) {
sameWindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2354 int enterDepth = 0;-
2355 int leaveDepth = 0;-
2356 auto *e = enter;-
2357 while (!e->isWindow() && (e = e->parentWidget()))
!e->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
(e = e->parentWidget())Description
TRUEnever evaluated
FALSEnever evaluated
0
2358 enterDepth++;
never executed: enterDepth++;
0
2359 auto *l = leave;-
2360 while (!l->isWindow() && (l = l->parentWidget()))
!l->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
(l = l->parentWidget())Description
TRUEnever evaluated
FALSEnever evaluated
0
2361 leaveDepth++;
never executed: leaveDepth++;
0
2362 QWidget* wenter = enter;-
2363 QWidget* wleave = leave;-
2364 while (enterDepth > leaveDepth) {
enterDepth > leaveDepthDescription
TRUEnever evaluated
FALSEnever evaluated
0
2365 wenter = wenter->parentWidget();-
2366 enterDepth--;-
2367 }
never executed: end of block
0
2368 while (leaveDepth > enterDepth) {
leaveDepth > enterDepthDescription
TRUEnever evaluated
FALSEnever evaluated
0
2369 wleave = wleave->parentWidget();-
2370 leaveDepth--;-
2371 }
never executed: end of block
0
2372 while (!wenter->isWindow() && wenter != wleave) {
!wenter->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
wenter != wleaveDescription
TRUEnever evaluated
FALSEnever evaluated
0
2373 wenter = wenter->parentWidget();-
2374 wleave = wleave->parentWidget();-
2375 }
never executed: end of block
0
2376-
2377 for (auto *w = leave; w != wleave; w = w->parentWidget())
w != wleaveDescription
TRUEnever evaluated
FALSEnever evaluated
0
2378 leaveList.append(w);
never executed: leaveList.append(w);
0
2379-
2380 for (auto *w = enter; w != wenter; w = w->parentWidget())
w != wenterDescription
TRUEnever evaluated
FALSEnever evaluated
0
2381 enterList.append(w);
never executed: enterList.append(w);
0
2382 }
never executed: end of block
0
2383-
2384 QEvent leaveEvent(QEvent::Leave);-
2385 for (int i = 0; i < leaveList.size(); ++i) {
i < leaveList.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
2386 auto *w = leaveList.at(i);-
2387 if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) {
!QApplication:...eModalWidget()Description
TRUEnever evaluated
FALSEnever evaluated
QApplicationPr...alHelper(w, 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
2388 QApplication::sendEvent(w, &leaveEvent);-
2389 if (w->testAttribute(Qt::WA_Hover) &&
w->testAttribute(Qt::WA_Hover)Description
TRUEnever evaluated
FALSEnever evaluated
0
2390 (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) {
!QApplication:...ePopupWidget()Description
TRUEnever evaluated
FALSEnever evaluated
QApplication::...== w->window()Description
TRUEnever evaluated
FALSEnever evaluated
0
2391 Q_ASSERT(instance());-
2392 QHoverEvent he(QEvent::HoverLeave, QPoint(-1, -1), w->mapFromGlobal(QApplicationPrivate::instance()->hoverGlobalPos),-
2393 QApplication::keyboardModifiers());-
2394 qApp->d_func()->notify_helper(w, &he);-
2395 }
never executed: end of block
0
2396 }
never executed: end of block
0
2397 }
never executed: end of block
0
2398 if (!enterList.isEmpty()) {
!enterList.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2399 // Guard against QGuiApplicationPrivate::lastCursorPosition initialized to qInf(), qInf().-
2400 const QPoint globalPos = qIsInf(globalPosF.x())
qIsInf(globalPosF.x())Description
TRUEnever evaluated
FALSEnever evaluated
0
2401 ? QPoint(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)-
2402 : globalPosF.toPoint();-
2403 const QPoint windowPos = qAsConst(enterList).back()->window()->mapFromGlobal(globalPos);-
2404 for (auto it = enterList.crbegin(), end = enterList.crend(); it != end; ++it) {
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
2405 auto *w = *it;-
2406 if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) {
!QApplication:...eModalWidget()Description
TRUEnever evaluated
FALSEnever evaluated
QApplicationPr...alHelper(w, 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
2407 const QPointF localPos = w->mapFromGlobal(globalPos);-
2408 QEnterEvent enterEvent(localPos, windowPos, globalPosF);-
2409 QApplication::sendEvent(w, &enterEvent);-
2410 if (w->testAttribute(Qt::WA_Hover) &&
w->testAttribute(Qt::WA_Hover)Description
TRUEnever evaluated
FALSEnever evaluated
0
2411 (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) {
!QApplication:...ePopupWidget()Description
TRUEnever evaluated
FALSEnever evaluated
QApplication::...== w->window()Description
TRUEnever evaluated
FALSEnever evaluated
0
2412 QHoverEvent he(QEvent::HoverEnter, localPos, QPoint(-1, -1),-
2413 QApplication::keyboardModifiers());-
2414 qApp->d_func()->notify_helper(w, &he);-
2415 }
never executed: end of block
0
2416 }
never executed: end of block
0
2417 }
never executed: end of block
0
2418 }
never executed: end of block
0
2419-
2420#ifndef QT_NO_CURSOR-
2421 // Update cursor for alien/graphics widgets.-
2422-
2423 const bool enterOnAlien = (enter && (isAlien(enter) || enter->testAttribute(Qt::WA_DontShowOnScreen)));
enterDescription
TRUEnever evaluated
FALSEnever evaluated
isAlien(enter)Description
TRUEnever evaluated
FALSEnever evaluated
enter->testAtt...tShowOnScreen)Description
TRUEnever evaluated
FALSEnever evaluated
0
2424 // Whenever we leave an alien widget on X11/QPA, we need to reset its nativeParentWidget()'s cursor.-
2425 // This is not required on Windows as the cursor is reset on every single mouse move.-
2426 QWidget *parentOfLeavingCursor = 0;-
2427 for (int i = 0; i < leaveList.size(); ++i) {
i < leaveList.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
2428 auto *w = leaveList.at(i);-
2429 if (!isAlien(w))
!isAlien(w)Description
TRUEnever evaluated
FALSEnever evaluated
0
2430 break;
never executed: break;
0
2431 if (w->testAttribute(Qt::WA_SetCursor)) {
w->testAttribu...:WA_SetCursor)Description
TRUEnever evaluated
FALSEnever evaluated
0
2432 QWidget *parent = w->parentWidget();-
2433 while (parent && parent->d_func()->data.in_destructor)
parentDescription
TRUEnever evaluated
FALSEnever evaluated
parent->d_func....in_destructorDescription
TRUEnever evaluated
FALSEnever evaluated
0
2434 parent = parent->parentWidget();
never executed: parent = parent->parentWidget();
0
2435 parentOfLeavingCursor = parent;-
2436 //continue looping, we need to find the downest alien widget with a cursor.-
2437 // (downest on the screen)-
2438 }
never executed: end of block
0
2439 }
never executed: end of block
0
2440 //check that we will not call qt_x11_enforce_cursor twice with the same native widget-
2441 if (parentOfLeavingCursor && (!enterOnAlien
parentOfLeavingCursorDescription
TRUEnever evaluated
FALSEnever evaluated
!enterOnAlienDescription
TRUEnever evaluated
FALSEnever evaluated
0
2442 || parentOfLeavingCursor->effectiveWinId() != enter->effectiveWinId())) {
parentOfLeavin...fectiveWinId()Description
TRUEnever evaluated
FALSEnever evaluated
0
2443#ifndef QT_NO_GRAPHICSVIEW-
2444 if (!parentOfLeavingCursor->window()->graphicsProxyWidget())
!parentOfLeavi...sProxyWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
2445#endif-
2446 {-
2447 if (enter == QApplication::desktop()) {
enter == QAppl...ion::desktop()Description
TRUEnever evaluated
FALSEnever evaluated
0
2448 qt_qpa_set_cursor(enter, true);-
2449 } else {
never executed: end of block
0
2450 qt_qpa_set_cursor(parentOfLeavingCursor, true);-
2451 }
never executed: end of block
0
2452 }-
2453 }
never executed: end of block
0
2454 if (enterOnAlien) {
enterOnAlienDescription
TRUEnever evaluated
FALSEnever evaluated
0
2455 QWidget *cursorWidget = enter;-
2456 while (!cursorWidget->isWindow() && !cursorWidget->isEnabled())
!cursorWidget->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
!cursorWidget->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
0
2457 cursorWidget = cursorWidget->parentWidget();
never executed: cursorWidget = cursorWidget->parentWidget();
0
2458-
2459 if (!cursorWidget)
!cursorWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
2460 return;
never executed: return;
0
2461-
2462#ifndef QT_NO_GRAPHICSVIEW-
2463 if (cursorWidget->window()->graphicsProxyWidget()) {
cursorWidget->...sProxyWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
2464 QWidgetPrivate::nearestGraphicsProxyWidget(cursorWidget)->setCursor(cursorWidget->cursor());-
2465 } else
never executed: end of block
0
2466#endif-
2467 {-
2468 qt_qpa_set_cursor(cursorWidget, true);-
2469 }
never executed: end of block
0
2470 }-
2471#endif-
2472}
never executed: end of block
0
2473-
2474/* exported for the benefit of testing tools */-
2475Q_WIDGETS_EXPORT bool qt_tryModalHelper(QWidget *widget, QWidget **rettop)-
2476{-
2477 return QApplicationPrivate::tryModalHelper(widget, rettop);
never executed: return QApplicationPrivate::tryModalHelper(widget, rettop);
0
2478}-
2479-
2480/*! \internal-
2481 Returns \c true if \a widget is blocked by a modal window.-
2482 */-
2483bool QApplicationPrivate::isBlockedByModal(QWidget *widget)-
2484{-
2485 widget = widget->window();-
2486 QWindow *window = widget->windowHandle();-
2487 return window && self->isWindowBlocked(window);
never executed: return window && self->isWindowBlocked(window);
0
2488}-
2489-
2490bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWindow) const-
2491{-
2492 QWindow *unused = 0;-
2493 if (Q_UNLIKELY(!window)) {
__builtin_expe...indow), false)Description
TRUEnever evaluated
FALSEnever evaluated
0
2494 qWarning().nospace() << "window == 0 passed.";-
2495 return false;
never executed: return false;
0
2496 }-
2497 if (!blockingWindow)
!blockingWindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2498 blockingWindow = &unused;
never executed: blockingWindow = &unused;
0
2499-
2500 if (modalWindowList.isEmpty()) {
modalWindowList.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2501 *blockingWindow = 0;-
2502 return false;
never executed: return false;
0
2503 }-
2504 QWidget *popupWidget = QApplication::activePopupWidget();-
2505 QWindow *popupWindow = popupWidget ? popupWidget->windowHandle() : 0;
popupWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
2506 if (popupWindow == window || (!popupWindow && QWindowPrivate::get(window)->isPopup())) {
popupWindow == windowDescription
TRUEnever evaluated
FALSEnever evaluated
!popupWindowDescription
TRUEnever evaluated
FALSEnever evaluated
QWindowPrivate...ow)->isPopup()Description
TRUEnever evaluated
FALSEnever evaluated
0
2507 *blockingWindow = 0;-
2508 return false;
never executed: return false;
0
2509 }-
2510-
2511 for (int i = 0; i < modalWindowList.count(); ++i) {
i < modalWindowList.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
2512 QWindow *modalWindow = modalWindowList.at(i);-
2513-
2514 {-
2515 // check if the modal window is our window or a (transient) parent of our window-
2516 QWindow *w = window;-
2517 while (w) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
2518 if (w == modalWindow) {
w == modalWindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2519 *blockingWindow = 0;-
2520 return false;
never executed: return false;
0
2521 }-
2522 QWindow *p = w->parent();-
2523 if (!p)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
0
2524 p = w->transientParent();
never executed: p = w->transientParent();
0
2525 w = p;-
2526 }
never executed: end of block
0
2527-
2528 // Embedded in-process windows are not visible in normal parent-child chain,-
2529 // so check the native parent chain, too.-
2530 const QPlatformWindow *platWin = window->handle();-
2531 const QPlatformWindow *modalPlatWin = modalWindow->handle();-
2532 if (platWin && modalPlatWin && platWin->isEmbedded(modalPlatWin))
platWinDescription
TRUEnever evaluated
FALSEnever evaluated
modalPlatWinDescription
TRUEnever evaluated
FALSEnever evaluated
platWin->isEmb...(modalPlatWin)Description
TRUEnever evaluated
FALSEnever evaluated
0
2533 return false;
never executed: return false;
0
2534 }-
2535-
2536 Qt::WindowModality windowModality = modalWindow->modality();-
2537 QWidgetWindow *modalWidgetWindow = qobject_cast<QWidgetWindow *>(modalWindow);-
2538 if (windowModality == Qt::NonModal) {
windowModality == Qt::NonModalDescription
TRUEnever evaluated
FALSEnever evaluated
0
2539 // determine the modality type if it hasn't been set on the-
2540 // modalWindow's widget, this normally happens when waiting for a-
2541 // native dialog. use WindowModal if we are the child of a group-
2542 // leader; otherwise use ApplicationModal.-
2543 QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : 0;
modalWidgetWindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2544 while (m && !m->testAttribute(Qt::WA_GroupLeader)) {
mDescription
TRUEnever evaluated
FALSEnever evaluated
!m->testAttrib...A_GroupLeader)Description
TRUEnever evaluated
FALSEnever evaluated
0
2545 m = m->parentWidget();-
2546 if (m)
mDescription
TRUEnever evaluated
FALSEnever evaluated
0
2547 m = m->window();
never executed: m = m->window();
0
2548 }
never executed: end of block
0
2549 windowModality = (m && m->testAttribute(Qt::WA_GroupLeader))
mDescription
TRUEnever evaluated
FALSEnever evaluated
m->testAttribu...A_GroupLeader)Description
TRUEnever evaluated
FALSEnever evaluated
0
2550 ? Qt::WindowModal-
2551 : Qt::ApplicationModal;-
2552 }
never executed: end of block
0
2553-
2554 switch (windowModality) {-
2555 case Qt::ApplicationModal:
never executed: case Qt::ApplicationModal:
0
2556 {-
2557 QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(window);-
2558 QWidget *groupLeaderForWidget = widgetWindow ? widgetWindow->widget() : 0;
widgetWindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2559 while (groupLeaderForWidget && !groupLeaderForWidget->testAttribute(Qt::WA_GroupLeader))
groupLeaderForWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
!groupLeaderFo...A_GroupLeader)Description
TRUEnever evaluated
FALSEnever evaluated
0
2560 groupLeaderForWidget = groupLeaderForWidget->parentWidget();
never executed: groupLeaderForWidget = groupLeaderForWidget->parentWidget();
0
2561-
2562 if (groupLeaderForWidget) {
groupLeaderForWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
2563 // if \a widget has WA_GroupLeader, it can only be blocked by ApplicationModal children-
2564 QWidget *m = modalWidgetWindow ? modalWidgetWindow->widget() : 0;
modalWidgetWindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2565 while (m && m != groupLeaderForWidget && !m->testAttribute(Qt::WA_GroupLeader))
mDescription
TRUEnever evaluated
FALSEnever evaluated
m != groupLeaderForWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
!m->testAttrib...A_GroupLeader)Description
TRUEnever evaluated
FALSEnever evaluated
0
2566 m = m->parentWidget();
never executed: m = m->parentWidget();
0
2567 if (m == groupLeaderForWidget) {
m == groupLeaderForWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
2568 *blockingWindow = m->windowHandle();-
2569 return true;
never executed: return true;
0
2570 }-
2571 } else if (modalWindow != window) {
never executed: end of block
modalWindow != windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2572 *blockingWindow = modalWindow;-
2573 return true;
never executed: return true;
0
2574 }-
2575 break;
never executed: break;
0
2576 }-
2577 case Qt::WindowModal:
never executed: case Qt::WindowModal:
0
2578 {-
2579 QWindow *w = window;-
2580 do {-
2581 QWindow *m = modalWindow;-
2582 do {-
2583 if (m == w) {
m == wDescription
TRUEnever evaluated
FALSEnever evaluated
0
2584 *blockingWindow = m;-
2585 return true;
never executed: return true;
0
2586 }-
2587 QWindow *p = m->parent();-
2588 if (!p)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
0
2589 p = m->transientParent();
never executed: p = m->transientParent();
0
2590 m = p;-
2591 } while (m);
never executed: end of block
mDescription
TRUEnever evaluated
FALSEnever evaluated
0
2592 QWindow *p = w->parent();-
2593 if (!p)
!pDescription
TRUEnever evaluated
FALSEnever evaluated
0
2594 p = w->transientParent();
never executed: p = w->transientParent();
0
2595 w = p;-
2596 } while (w);
never executed: end of block
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
2597 break;
never executed: break;
0
2598 }-
2599 default:
never executed: default:
0
2600 Q_ASSERT_X(false, "QApplication", "internal error, a modal window cannot be modeless");-
2601 break;
never executed: break;
0
2602 }-
2603 }-
2604 *blockingWindow = 0;-
2605 return false;
never executed: return false;
0
2606}-
2607-
2608/*!\internal-
2609-
2610 Called from qapplication_\e{platform}.cpp, returns \c true-
2611 if the widget should accept the event.-
2612 */-
2613bool QApplicationPrivate::tryModalHelper(QWidget *widget, QWidget **rettop)-
2614{-
2615 QWidget *top = QApplication::activeModalWidget();-
2616 if (rettop)
rettopDescription
TRUEnever evaluated
FALSEnever evaluated
0
2617 *rettop = top;
never executed: *rettop = top;
0
2618-
2619 // the active popup widget always gets the input event-
2620 if (QApplication::activePopupWidget())
QApplication::...ePopupWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
2621 return true;
never executed: return true;
0
2622-
2623 return !isBlockedByModal(widget->window());
never executed: return !isBlockedByModal(widget->window());
0
2624}-
2625-
2626bool qt_try_modal(QWidget *widget, QEvent::Type type)-
2627{-
2628 QWidget * top = 0;-
2629-
2630 if (QApplicationPrivate::tryModalHelper(widget, &top))
QApplicationPr...(widget, &top)Description
TRUEnever evaluated
FALSEnever evaluated
0
2631 return true;
never executed: return true;
0
2632-
2633 bool block_event = false;-
2634-
2635 switch (type) {-
2636#if 0-
2637 case QEvent::Focus:-
2638 if (!static_cast<QWSFocusEvent*>(event)->simpleData.get_focus)-
2639 break;-
2640 // drop through-
2641#endif-
2642 case QEvent::MouseButtonPress: // disallow mouse/key events
never executed: case QEvent::MouseButtonPress:
0
2643 case QEvent::MouseButtonRelease:
never executed: case QEvent::MouseButtonRelease:
0
2644 case QEvent::MouseMove:
never executed: case QEvent::MouseMove:
0
2645 case QEvent::KeyPress:
never executed: case QEvent::KeyPress:
0
2646 case QEvent::KeyRelease:
never executed: case QEvent::KeyRelease:
0
2647 block_event = true;-
2648 break;
never executed: break;
0
2649 default:
never executed: default:
0
2650 break;
never executed: break;
0
2651 }-
2652-
2653 if (block_event && top && top->parentWidget() == 0)
block_eventDescription
TRUEnever evaluated
FALSEnever evaluated
topDescription
TRUEnever evaluated
FALSEnever evaluated
top->parentWidget() == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2654 top->raise();
never executed: top->raise();
0
2655-
2656 return !block_event;
never executed: return !block_event;
0
2657}-
2658-
2659bool QApplicationPrivate::modalState()-
2660{-
2661 return !self->modalWindowList.isEmpty();
never executed: return !self->modalWindowList.isEmpty();
0
2662}-
2663-
2664/*-
2665 \internal-
2666*/-
2667QWidget *QApplicationPrivate::pickMouseReceiver(QWidget *candidate, const QPoint &windowPos,-
2668 QPoint *pos, QEvent::Type type,-
2669 Qt::MouseButtons buttons, QWidget *buttonDown,-
2670 QWidget *alienWidget)-
2671{-
2672 Q_ASSERT(candidate);-
2673-
2674 QWidget *mouseGrabber = QWidget::mouseGrabber();-
2675 if (((type == QEvent::MouseMove && buttons) || (type == QEvent::MouseButtonRelease))
type == QEvent::MouseMoveDescription
TRUEnever evaluated
FALSEnever evaluated
buttonsDescription
TRUEnever evaluated
FALSEnever evaluated
(type == QEven...ButtonRelease)Description
TRUEnever evaluated
FALSEnever evaluated
0
2676 && !buttonDown && !mouseGrabber) {
!buttonDownDescription
TRUEnever evaluated
FALSEnever evaluated
!mouseGrabberDescription
TRUEnever evaluated
FALSEnever evaluated
0
2677 return 0;
never executed: return 0;
0
2678 }-
2679-
2680 if (alienWidget && alienWidget->internalWinId())
alienWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
alienWidget->internalWinId()Description
TRUEnever evaluated
FALSEnever evaluated
0
2681 alienWidget = 0;
never executed: alienWidget = 0;
0
2682-
2683 QWidget *receiver = candidate;-
2684-
2685 if (!mouseGrabber)
!mouseGrabberDescription
TRUEnever evaluated
FALSEnever evaluated
0
2686 mouseGrabber = (buttonDown && !isBlockedByModal(buttonDown)) ? buttonDown : alienWidget;
never executed: mouseGrabber = (buttonDown && !isBlockedByModal(buttonDown)) ? buttonDown : alienWidget;
buttonDownDescription
TRUEnever evaluated
FALSEnever evaluated
!isBlockedByModal(buttonDown)Description
TRUEnever evaluated
FALSEnever evaluated
0
2687-
2688 if (mouseGrabber && mouseGrabber != candidate) {
mouseGrabberDescription
TRUEnever evaluated
FALSEnever evaluated
mouseGrabber != candidateDescription
TRUEnever evaluated
FALSEnever evaluated
0
2689 receiver = mouseGrabber;-
2690 *pos = receiver->mapFromGlobal(candidate->mapToGlobal(windowPos));-
2691#ifdef ALIEN_DEBUG-
2692 qDebug() << " ** receiver adjusted to:" << receiver << "pos:" << pos;-
2693#endif-
2694 }
never executed: end of block
0
2695-
2696 return receiver;
never executed: return receiver;
0
2697-
2698}-
2699-
2700/*-
2701 \internal-
2702*/-
2703bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,-
2704 QWidget *alienWidget, QWidget *nativeWidget,-
2705 QWidget **buttonDown, QPointer<QWidget> &lastMouseReceiver,-
2706 bool spontaneous)-
2707{-
2708 Q_ASSERT(receiver);-
2709 Q_ASSERT(event);-
2710 Q_ASSERT(nativeWidget);-
2711 Q_ASSERT(buttonDown);-
2712-
2713 if (alienWidget && !isAlien(alienWidget))
alienWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
!isAlien(alienWidget)Description
TRUEnever evaluated
FALSEnever evaluated
0
2714 alienWidget = 0;
never executed: alienWidget = 0;
0
2715-
2716 QPointer<QWidget> receiverGuard = receiver;-
2717 QPointer<QWidget> nativeGuard = nativeWidget;-
2718 QPointer<QWidget> alienGuard = alienWidget;-
2719 QPointer<QWidget> activePopupWidget = QApplication::activePopupWidget();-
2720-
2721 const bool graphicsWidget = nativeWidget->testAttribute(Qt::WA_DontShowOnScreen);-
2722-
2723 bool widgetUnderMouse = QRectF(receiver->rect()).contains(event->localPos());-
2724-
2725 // Clear the obsolete leaveAfterRelease value, if mouse button has been released but-
2726 // leaveAfterRelease has not been updated.-
2727 // This happens e.g. when modal dialog or popup is shown as a response to button click.-
2728 if (leaveAfterRelease && !*buttonDown && !event->buttons())
leaveAfterReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
!*buttonDownDescription
TRUEnever evaluated
FALSEnever evaluated
!event->buttons()Description
TRUEnever evaluated
FALSEnever evaluated
0
2729 leaveAfterRelease = 0;
never executed: leaveAfterRelease = 0;
0
2730-
2731 if (*buttonDown) {
*buttonDownDescription
TRUEnever evaluated
FALSEnever evaluated
0
2732 if (!graphicsWidget) {
!graphicsWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
2733 // Register the widget that shall receive a leave event-
2734 // after the last button is released.-
2735 if ((alienWidget || !receiver->internalWinId()) && !leaveAfterRelease && !QWidget::mouseGrabber())
alienWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
!receiver->internalWinId()Description
TRUEnever evaluated
FALSEnever evaluated
!leaveAfterReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
!QWidget::mouseGrabber()Description
TRUEnever evaluated
FALSEnever evaluated
0
2736 leaveAfterRelease = *buttonDown;
never executed: leaveAfterRelease = *buttonDown;
0
2737 if (event->type() == QEvent::MouseButtonRelease && !event->buttons())
event->type() ...eButtonReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
!event->buttons()Description
TRUEnever evaluated
FALSEnever evaluated
0
2738 *buttonDown = 0;
never executed: *buttonDown = 0;
0
2739 }
never executed: end of block
0
2740 } else if (lastMouseReceiver && widgetUnderMouse) {
never executed: end of block
lastMouseReceiverDescription
TRUEnever evaluated
FALSEnever evaluated
widgetUnderMouseDescription
TRUEnever evaluated
FALSEnever evaluated
0
2741 // Dispatch enter/leave if we move:-
2742 // 1) from an alien widget to another alien widget or-
2743 // from a native widget to an alien widget (first OR case)-
2744 // 2) from an alien widget to a native widget (second OR case)-
2745 if ((alienWidget && alienWidget != lastMouseReceiver)
alienWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
alienWidget !=...tMouseReceiverDescription
TRUEnever evaluated
FALSEnever evaluated
0
2746 || (isAlien(lastMouseReceiver) && !alienWidget)) {
isAlien(lastMouseReceiver)Description
TRUEnever evaluated
FALSEnever evaluated
!alienWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
2747 if (activePopupWidget) {
activePopupWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
2748 if (!QWidget::mouseGrabber())
!QWidget::mouseGrabber()Description
TRUEnever evaluated
FALSEnever evaluated
0
2749 dispatchEnterLeave(alienWidget ? alienWidget : nativeWidget, lastMouseReceiver, event->screenPos());
never executed: dispatchEnterLeave(alienWidget ? alienWidget : nativeWidget, lastMouseReceiver, event->screenPos());
0
2750 } else {
never executed: end of block
0
2751 dispatchEnterLeave(receiver, lastMouseReceiver, event->screenPos());-
2752 }
never executed: end of block
0
2753-
2754 }-
2755 }
never executed: end of block
0
2756-
2757#ifdef ALIEN_DEBUG-
2758 qDebug() << "QApplicationPrivate::sendMouseEvent: receiver:" << receiver-
2759 << "pos:" << event->pos() << "alien" << alienWidget << "button down"-
2760 << *buttonDown << "last" << lastMouseReceiver << "leave after release"-
2761 << leaveAfterRelease;-
2762#endif-
2763-
2764 // We need this quard in case someone opens a modal dialog / popup. If that's the case-
2765 // leaveAfterRelease is set to null, but we shall not update lastMouseReceiver.-
2766 const bool wasLeaveAfterRelease = leaveAfterRelease != 0;-
2767 bool result;-
2768 if (spontaneous)
spontaneousDescription
TRUEnever evaluated
FALSEnever evaluated
0
2769 result = QApplication::sendSpontaneousEvent(receiver, event);
never executed: result = QApplication::sendSpontaneousEvent(receiver, event);
0
2770 else-
2771 result = QApplication::sendEvent(receiver, event);
never executed: result = QApplication::sendEvent(receiver, event);
0
2772-
2773 if (!graphicsWidget && leaveAfterRelease && event->type() == QEvent::MouseButtonRelease
!graphicsWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
leaveAfterReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
event->type() ...eButtonReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
0
2774 && !event->buttons() && QWidget::mouseGrabber() != leaveAfterRelease) {
!event->buttons()Description
TRUEnever evaluated
FALSEnever evaluated
QWidget::mouse...veAfterReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
0
2775 // Dispatch enter/leave if:-
2776 // 1) the mouse grabber is an alien widget-
2777 // 2) the button is released on an alien widget-
2778 QWidget *enter = 0;-
2779 if (nativeGuard)
nativeGuardDescription
TRUEnever evaluated
FALSEnever evaluated
0
2780 enter = alienGuard ? alienWidget : nativeWidget;
never executed: enter = alienGuard ? alienWidget : nativeWidget;
alienGuardDescription
TRUEnever evaluated
FALSEnever evaluated
0
2781 else // The receiver is typically deleted on mouse release with drag'n'drop.-
2782 enter = QApplication::widgetAt(event->globalPos());
never executed: enter = QApplication::widgetAt(event->globalPos());
0
2783 dispatchEnterLeave(enter, leaveAfterRelease, event->screenPos());-
2784 leaveAfterRelease = 0;-
2785 lastMouseReceiver = enter;-
2786 } else if (!wasLeaveAfterRelease) {
never executed: end of block
!wasLeaveAfterReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
0
2787 if (activePopupWidget) {
activePopupWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
2788 if (!QWidget::mouseGrabber())
!QWidget::mouseGrabber()Description
TRUEnever evaluated
FALSEnever evaluated
0
2789 lastMouseReceiver = alienGuard ? alienWidget : (nativeGuard ? nativeWidget : 0);
never executed: lastMouseReceiver = alienGuard ? alienWidget : (nativeGuard ? nativeWidget : 0);
alienGuardDescription
TRUEnever evaluated
FALSEnever evaluated
nativeGuardDescription
TRUEnever evaluated
FALSEnever evaluated
0
2790 } else {
never executed: end of block
0
2791 lastMouseReceiver = receiverGuard ? receiver : QApplication::widgetAt(event->globalPos());
receiverGuardDescription
TRUEnever evaluated
FALSEnever evaluated
0
2792 }
never executed: end of block
0
2793 }-
2794-
2795 return result;
never executed: return result;
0
2796}-
2797-
2798/*-
2799 This function should only be called when the widget changes visibility, i.e.-
2800 when the \a widget is shown, hidden or deleted. This function does nothing-
2801 if the widget is a top-level or native, i.e. not an alien widget. In that-
2802 case enter/leave events are genereated by the underlying windowing system.-
2803*/-
2804extern QPointer<QWidget> qt_last_mouse_receiver;-
2805extern QWidget *qt_button_down;-
2806void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget)-
2807{-
2808#ifndef QT_NO_CURSOR-
2809 if (!widget || widget->isWindow())
!widgetDescription
TRUEnever evaluated
FALSEnever evaluated
widget->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
2810 return;
never executed: return;
0
2811 const bool widgetInShow = widget->isVisible() && !widget->data->in_destructor;
widget->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
!widget->data->in_destructorDescription
TRUEnever evaluated
FALSEnever evaluated
0
2812 if (!widgetInShow && widget != qt_last_mouse_receiver)
!widgetInShowDescription
TRUEnever evaluated
FALSEnever evaluated
widget != qt_l...mouse_receiverDescription
TRUEnever evaluated
FALSEnever evaluated
0
2813 return; // Widget was not under the cursor when it was hidden/deleted.
never executed: return;
0
2814-
2815 if (widgetInShow && widget->parentWidget()->data->in_show)
widgetInShowDescription
TRUEnever evaluated
FALSEnever evaluated
widget->parent...>data->in_showDescription
TRUEnever evaluated
FALSEnever evaluated
0
2816 return; // Ingore recursive show.
never executed: return;
0
2817-
2818 QWidget *mouseGrabber = QWidget::mouseGrabber();-
2819 if (mouseGrabber && mouseGrabber != widget)
mouseGrabberDescription
TRUEnever evaluated
FALSEnever evaluated
mouseGrabber != widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
2820 return; // Someone else has the grab; enter/leave should not occur.
never executed: return;
0
2821-
2822 QWidget *tlw = widget->window();-
2823 if (tlw->data->in_destructor || tlw->data->is_closing)
tlw->data->in_destructorDescription
TRUEnever evaluated
FALSEnever evaluated
tlw->data->is_closingDescription
TRUEnever evaluated
FALSEnever evaluated
0
2824 return; // Closing down the business.
never executed: return;
0
2825-
2826 if (widgetInShow && (!qt_last_mouse_receiver || qt_last_mouse_receiver->window() != tlw))
widgetInShowDescription
TRUEnever evaluated
FALSEnever evaluated
!qt_last_mouse_receiverDescription
TRUEnever evaluated
FALSEnever evaluated
qt_last_mouse_...indow() != tlwDescription
TRUEnever evaluated
FALSEnever evaluated
0
2827 return; // Mouse cursor not inside the widget's top-level.
never executed: return;
0
2828-
2829 const QPoint globalPos(QCursor::pos());-
2830 QPoint windowPos = tlw->mapFromGlobal(globalPos);-
2831-
2832 // Find the current widget under the mouse. If this function was called from-
2833 // the widget's destructor, we have to make sure childAt() doesn't take into-
2834 // account widgets that are about to be destructed.-
2835 QWidget *widgetUnderCursor = tlw->d_func()->childAt_helper(windowPos, widget->data->in_destructor);-
2836 if (!widgetUnderCursor)
!widgetUnderCursorDescription
TRUEnever evaluated
FALSEnever evaluated
0
2837 widgetUnderCursor = tlw;
never executed: widgetUnderCursor = tlw;
0
2838 QPoint pos = widgetUnderCursor->mapFrom(tlw, windowPos);-
2839-
2840 if (widgetInShow && widgetUnderCursor != widget && !widget->isAncestorOf(widgetUnderCursor))
widgetInShowDescription
TRUEnever evaluated
FALSEnever evaluated
widgetUnderCursor != widgetDescription
TRUEnever evaluated
FALSEnever evaluated
!widget->isAnc...etUnderCursor)Description
TRUEnever evaluated
FALSEnever evaluated
0
2841 return; // Mouse cursor not inside the widget or any of its children.
never executed: return;
0
2842-
2843 if (widget->data->in_destructor && qt_button_down == widget)
widget->data->in_destructorDescription
TRUEnever evaluated
FALSEnever evaluated
qt_button_down == widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
2844 qt_button_down = 0;
never executed: qt_button_down = 0;
0
2845-
2846 // Send enter/leave events followed by a mouse move on the entered widget.-
2847 QMouseEvent e(QEvent::MouseMove, pos, windowPos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier);-
2848 sendMouseEvent(widgetUnderCursor, &e, widgetUnderCursor, tlw, &qt_button_down, qt_last_mouse_receiver);-
2849#endif // QT_NO_CURSOR-
2850}
never executed: end of block
0
2851-
2852/*!-
2853 Returns the desktop widget (also called the root window).-
2854-
2855 The desktop may be composed of multiple screens, so it would be incorrect,-
2856 for example, to attempt to \e center some widget in the desktop's geometry.-
2857 QDesktopWidget has various functions for obtaining useful geometries upon-
2858 the desktop, such as QDesktopWidget::screenGeometry() and-
2859 QDesktopWidget::availableGeometry().-
2860-
2861 On X11, it is also possible to draw on the desktop.-
2862*/-
2863QDesktopWidget *QApplication::desktop()-
2864{-
2865 CHECK_QAPP_INSTANCE(Q_NULLPTR)
never executed: end of block
never executed: return nullptr;
__builtin_expe...ance()), true)Description
TRUEnever evaluated
FALSEnever evaluated
0
2866 if (!qt_desktopWidget || // not created yet
!qt_desktopWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
2867 !(qt_desktopWidget->windowType() == Qt::Desktop)) { // reparented away
!(qt_desktopWi...= Qt::Desktop)Description
TRUEnever evaluated
FALSEnever evaluated
0
2868 qt_desktopWidget = new QDesktopWidget();-
2869 }
never executed: end of block
0
2870 return qt_desktopWidget;
never executed: return qt_desktopWidget;
0
2871}-
2872-
2873/*-
2874 Sets the time after which a drag should start to \a ms ms.-
2875-
2876 \sa startDragTime()-
2877*/-
2878-
2879void QApplication::setStartDragTime(int ms)-
2880{-
2881 QGuiApplication::styleHints()->setStartDragTime(ms);-
2882}
never executed: end of block
0
2883-
2884/*!-
2885 \property QApplication::startDragTime-
2886 \brief the time in milliseconds that a mouse button must be held down-
2887 before a drag and drop operation will begin-
2888-
2889 If you support drag and drop in your application, and want to start a drag-
2890 and drop operation after the user has held down a mouse button for a-
2891 certain amount of time, you should use this property's value as the delay.-
2892-
2893 Qt also uses this delay internally, e.g. in QTextEdit and QLineEdit, for-
2894 starting a drag.-
2895-
2896 The default value is 500 ms.-
2897-
2898 \sa startDragDistance(), {Drag and Drop}-
2899*/-
2900-
2901int QApplication::startDragTime()-
2902{-
2903 return QGuiApplication::styleHints()->startDragTime();
never executed: return QGuiApplication::styleHints()->startDragTime();
0
2904}-
2905-
2906/*-
2907 Sets the distance after which a drag should start to \a l pixels.-
2908-
2909 \sa startDragDistance()-
2910*/-
2911-
2912void QApplication::setStartDragDistance(int l)-
2913{-
2914 QGuiApplication::styleHints()->setStartDragDistance(l);-
2915}
never executed: end of block
0
2916-
2917/*!-
2918 \property QApplication::startDragDistance-
2919-
2920 If you support drag and drop in your application, and want to start a drag-
2921 and drop operation after the user has moved the cursor a certain distance-
2922 with a button held down, you should use this property's value as the-
2923 minimum distance required.-
2924-
2925 For example, if the mouse position of the click is stored in \c startPos-
2926 and the current position (e.g. in the mouse move event) is \c currentPos,-
2927 you can find out if a drag should be started with code like this:-
2928-
2929 \snippet code/src_gui_kernel_qapplication.cpp 6-
2930-
2931 Qt uses this value internally, e.g. in QFileDialog.-
2932-
2933 The default value (if the platform doesn't provide a different default)-
2934 is 10 pixels.-
2935-
2936 \sa startDragTime(), QPoint::manhattanLength(), {Drag and Drop}-
2937*/-
2938-
2939int QApplication::startDragDistance()-
2940{-
2941 return QGuiApplication::styleHints()->startDragDistance();
never executed: return QGuiApplication::styleHints()->startDragDistance();
0
2942}-
2943-
2944/*!-
2945 Enters the main event loop and waits until exit() is called, then returns-
2946 the value that was set to exit() (which is 0 if exit() is called via-
2947 quit()).-
2948-
2949 It is necessary to call this function to start event handling. The main-
2950 event loop receives events from the window system and dispatches these to-
2951 the application widgets.-
2952-
2953 Generally, no user interaction can take place before calling exec(). As a-
2954 special case, modal widgets like QMessageBox can be used before calling-
2955 exec(), because modal widgets call exec() to start a local event loop.-
2956-
2957 To make your application perform idle processing, i.e., executing a special-
2958 function whenever there are no pending events, use a QTimer with 0 timeout.-
2959 More advanced idle processing schemes can be achieved using processEvents().-
2960-
2961 We recommend that you connect clean-up code to the-
2962 \l{QCoreApplication::}{aboutToQuit()} signal, instead of putting it in your-
2963 application's \c{main()} function. This is because, on some platforms the-
2964 QApplication::exec() call may not return. For example, on the Windows-
2965 platform, when the user logs off, the system terminates the process after Qt-
2966 closes all top-level windows. Hence, there is \e{no guarantee} that the-
2967 application will have time to exit its event loop and execute code at the-
2968 end of the \c{main()} function, after the QApplication::exec() call.-
2969-
2970 \sa quitOnLastWindowClosed, QCoreApplication::quit(), QCoreApplication::exit(),-
2971 QCoreApplication::processEvents(), QCoreApplication::exec()-
2972*/-
2973int QApplication::exec()-
2974{-
2975 return QGuiApplication::exec();
never executed: return QGuiApplication::exec();
0
2976}-
2977-
2978bool QApplicationPrivate::shouldQuit()-
2979{-
2980 /* if there is no non-withdrawn primary window left (except-
2981 the ones without QuitOnClose), we emit the lastWindowClosed-
2982 signal */-
2983 QWidgetList list = QApplication::topLevelWidgets();-
2984 QWindowList processedWindows;-
2985 for (int i = 0; i < list.size(); ++i) {
i < list.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
2986 QWidget *w = list.at(i);-
2987 if (QWindow *window = w->windowHandle()) { // Menus, popup widgets may not have a QWindow
QWindow *windo...windowHandle()Description
TRUEnever evaluated
FALSEnever evaluated
0
2988 processedWindows.push_back(window);-
2989 if (w->isVisible() && !w->parentWidget() && w->testAttribute(Qt::WA_QuitOnClose))
w->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
!w->parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
w->testAttribu...A_QuitOnClose)Description
TRUEnever evaluated
FALSEnever evaluated
0
2990 return false;
never executed: return false;
0
2991 }
never executed: end of block
0
2992 }
never executed: end of block
0
2993 return QGuiApplicationPrivate::shouldQuitInternal(processedWindows);
never executed: return QGuiApplicationPrivate::shouldQuitInternal(processedWindows);
0
2994}-
2995-
2996static inline void closeAllPopups()-
2997{-
2998 // Close all popups: In case some popup refuses to close,-
2999 // we give up after 1024 attempts (to avoid an infinite loop).-
3000 int maxiter = 1024;-
3001 QWidget *popup;-
3002 while ((popup = QApplication::activePopupWidget()) && maxiter--)
(popup = QAppl...PopupWidget())Description
TRUEnever evaluated
FALSEnever evaluated
maxiter--Description
TRUEnever evaluated
FALSEnever evaluated
0
3003 popup->close();
never executed: popup->close();
0
3004}
never executed: end of block
0
3005-
3006/*! \reimp-
3007 */-
3008bool QApplication::notify(QObject *receiver, QEvent *e)-
3009{-
3010 Q_D(QApplication);-
3011 // no events are delivered after ~QCoreApplication() has started-
3012 if (QApplicationPrivate::is_app_closing)
QApplicationPr...is_app_closingDescription
TRUEnever evaluated
FALSEnever evaluated
0
3013 return true;
never executed: return true;
0
3014-
3015 if (Q_UNLIKELY(!receiver)) { // serious error
__builtin_expe...eiver), false)Description
TRUEnever evaluated
FALSEnever evaluated
0
3016 qWarning("QApplication::notify: Unexpected null receiver");-
3017 return true;
never executed: return true;
0
3018 }-
3019-
3020#ifndef QT_NO_DEBUG-
3021 d->checkReceiverThread(receiver);-
3022#endif-
3023-
3024 if (receiver->isWindowType())
receiver->isWindowType()Description
TRUEnever evaluated
FALSEnever evaluated
0
3025 QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(static_cast<QWindow *>(receiver), e);
never executed: QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(static_cast<QWindow *>(receiver), e);
0
3026-
3027 if(e->spontaneous()) {
e->spontaneous()Description
TRUEnever evaluated
FALSEnever evaluated
0
3028 // Capture the current mouse and keyboard states. Doing so here is-
3029 // required in order to support Qt Test synthesized events. Real mouse-
3030 // and keyboard state updates from the platform plugin are managed by-
3031 // QGuiApplicationPrivate::process(Mouse|Wheel|Key|Touch|Tablet)Event();-
3032 switch (e->type()) {-
3033 case QEvent::MouseButtonPress:
never executed: case QEvent::MouseButtonPress:
0
3034 {-
3035 QMouseEvent *me = static_cast<QMouseEvent*>(e);-
3036 QApplicationPrivate::modifier_buttons = me->modifiers();-
3037 QApplicationPrivate::mouse_buttons |= me->button();-
3038 break;
never executed: break;
0
3039 }-
3040 case QEvent::MouseButtonDblClick:
never executed: case QEvent::MouseButtonDblClick:
0
3041 {-
3042 QMouseEvent *me = static_cast<QMouseEvent*>(e);-
3043 QApplicationPrivate::modifier_buttons = me->modifiers();-
3044 QApplicationPrivate::mouse_buttons |= me->button();-
3045 break;
never executed: break;
0
3046 }-
3047 case QEvent::MouseButtonRelease:
never executed: case QEvent::MouseButtonRelease:
0
3048 {-
3049 QMouseEvent *me = static_cast<QMouseEvent*>(e);-
3050 QApplicationPrivate::modifier_buttons = me->modifiers();-
3051 QApplicationPrivate::mouse_buttons &= ~me->button();-
3052 break;
never executed: break;
0
3053 }-
3054 case QEvent::KeyPress:
never executed: case QEvent::KeyPress:
0
3055 case QEvent::KeyRelease:
never executed: case QEvent::KeyRelease:
0
3056 case QEvent::MouseMove:
never executed: case QEvent::MouseMove:
0
3057#ifndef QT_NO_WHEELEVENT-
3058 case QEvent::Wheel:
never executed: case QEvent::Wheel:
0
3059#endif-
3060 case QEvent::TouchBegin:
never executed: case QEvent::TouchBegin:
0
3061 case QEvent::TouchUpdate:
never executed: case QEvent::TouchUpdate:
0
3062 case QEvent::TouchEnd:
never executed: case QEvent::TouchEnd:
0
3063#ifndef QT_NO_TABLETEVENT-
3064 case QEvent::TabletMove:
never executed: case QEvent::TabletMove:
0
3065 case QEvent::TabletPress:
never executed: case QEvent::TabletPress:
0
3066 case QEvent::TabletRelease:
never executed: case QEvent::TabletRelease:
0
3067#endif-
3068 {-
3069 QInputEvent *ie = static_cast<QInputEvent*>(e);-
3070 QApplicationPrivate::modifier_buttons = ie->modifiers();-
3071 break;
never executed: break;
0
3072 }-
3073 default:
never executed: default:
0
3074 break;
never executed: break;
0
3075 }-
3076 }-
3077-
3078#ifndef QT_NO_GESTURES-
3079 // walk through parents and check for gestures-
3080 if (d->gestureManager) {
d->gestureManagerDescription
TRUEnever evaluated
FALSEnever evaluated
0
3081 switch (e->type()) {-
3082 case QEvent::Paint:
never executed: case QEvent::Paint:
0
3083 case QEvent::MetaCall:
never executed: case QEvent::MetaCall:
0
3084 case QEvent::DeferredDelete:
never executed: case QEvent::DeferredDelete:
0
3085 case QEvent::DragEnter: case QEvent::DragMove: case QEvent::DragLeave:
never executed: case QEvent::DragEnter:
never executed: case QEvent::DragMove:
never executed: case QEvent::DragLeave:
0
3086 case QEvent::Drop: case QEvent::DragResponse:
never executed: case QEvent::Drop:
never executed: case QEvent::DragResponse:
0
3087 case QEvent::ChildAdded: case QEvent::ChildPolished:
never executed: case QEvent::ChildAdded:
never executed: case QEvent::ChildPolished:
0
3088 case QEvent::ChildRemoved:
never executed: case QEvent::ChildRemoved:
0
3089 case QEvent::UpdateRequest:
never executed: case QEvent::UpdateRequest:
0
3090 case QEvent::UpdateLater:
never executed: case QEvent::UpdateLater:
0
3091 case QEvent::LocaleChange:
never executed: case QEvent::LocaleChange:
0
3092 case QEvent::Style:
never executed: case QEvent::Style:
0
3093 case QEvent::IconDrag:
never executed: case QEvent::IconDrag:
0
3094 case QEvent::StyleChange:
never executed: case QEvent::StyleChange:
0
3095 case QEvent::GraphicsSceneDragEnter:
never executed: case QEvent::GraphicsSceneDragEnter:
0
3096 case QEvent::GraphicsSceneDragMove:
never executed: case QEvent::GraphicsSceneDragMove:
0
3097 case QEvent::GraphicsSceneDragLeave:
never executed: case QEvent::GraphicsSceneDragLeave:
0
3098 case QEvent::GraphicsSceneDrop:
never executed: case QEvent::GraphicsSceneDrop:
0
3099 case QEvent::DynamicPropertyChange:
never executed: case QEvent::DynamicPropertyChange:
0
3100 case QEvent::NetworkReplyUpdated:
never executed: case QEvent::NetworkReplyUpdated:
0
3101 break;
never executed: break;
0
3102 default:
never executed: default:
0
3103 if (d->gestureManager->thread() == QThread::currentThread()) {
d->gestureMana...urrentThread()Description
TRUEnever evaluated
FALSEnever evaluated
0
3104 if (receiver->isWidgetType()) {
receiver->isWidgetType()Description
TRUEnever evaluated
FALSEnever evaluated
0
3105 if (d->gestureManager->filterEvent(static_cast<QWidget *>(receiver), e))
d->gestureMana...(receiver), e)Description
TRUEnever evaluated
FALSEnever evaluated
0
3106 return true;
never executed: return true;
0
3107 } else {
never executed: end of block
0
3108 // a special case for events that go to QGesture objects.-
3109 // We pass the object to the gesture manager and it'll figure-
3110 // out if it's QGesture or not.-
3111 if (d->gestureManager->filterEvent(receiver, e))
d->gestureMana...t(receiver, e)Description
TRUEnever evaluated
FALSEnever evaluated
0
3112 return true;
never executed: return true;
0
3113 }
never executed: end of block
0
3114 }-
3115 break;
never executed: break;
0
3116 }-
3117 }-
3118#endif // QT_NO_GESTURES-
3119-
3120 switch (e->type()) {-
3121 case QEvent::ApplicationDeactivate:
never executed: case QEvent::ApplicationDeactivate:
0
3122 // Close all popups (triggers when switching applications-
3123 // by pressing ALT-TAB on Windows, which is not receive as key event.-
3124 closeAllPopups();-
3125 break;
never executed: break;
0
3126 case QEvent::Wheel: // User input and window activation makes tooltips sleep
never executed: case QEvent::Wheel:
0
3127 case QEvent::ActivationChange:
never executed: case QEvent::ActivationChange:
0
3128 case QEvent::KeyPress:
never executed: case QEvent::KeyPress:
0
3129 case QEvent::KeyRelease:
never executed: case QEvent::KeyRelease:
0
3130 case QEvent::FocusOut:
never executed: case QEvent::FocusOut:
0
3131 case QEvent::FocusIn:
never executed: case QEvent::FocusIn:
0
3132 case QEvent::MouseButtonPress:
never executed: case QEvent::MouseButtonPress:
0
3133 case QEvent::MouseButtonRelease:
never executed: case QEvent::MouseButtonRelease:
0
3134 case QEvent::MouseButtonDblClick:
never executed: case QEvent::MouseButtonDblClick:
0
3135 d->toolTipFallAsleep.stop();-
3136 // fall-through-
3137 case QEvent::Leave:
code before this statement never executed: case QEvent::Leave:
never executed: case QEvent::Leave:
0
3138 d->toolTipWakeUp.stop();-
3139 default:
code before this statement never executed: default:
never executed: default:
0
3140 break;
never executed: break;
0
3141 }-
3142-
3143 switch (e->type()) {-
3144 case QEvent::KeyPress: {
never executed: case QEvent::KeyPress:
0
3145 int key = static_cast<QKeyEvent*>(e)->key();-
3146 qt_in_tab_key_event = (key == Qt::Key_Backtab
key == Qt::Key_BacktabDescription
TRUEnever evaluated
FALSEnever evaluated
0
3147 || key == Qt::Key_Tab
key == Qt::Key_TabDescription
TRUEnever evaluated
FALSEnever evaluated
0
3148 || key == Qt::Key_Left
key == Qt::Key_LeftDescription
TRUEnever evaluated
FALSEnever evaluated
0
3149 || key == Qt::Key_Up
key == Qt::Key_UpDescription
TRUEnever evaluated
FALSEnever evaluated
0
3150 || key == Qt::Key_Right
key == Qt::Key_RightDescription
TRUEnever evaluated
FALSEnever evaluated
0
3151 || key == Qt::Key_Down);
key == Qt::Key_DownDescription
TRUEnever evaluated
FALSEnever evaluated
0
3152 }-
3153 default:
code before this statement never executed: default:
never executed: default:
0
3154 break;
never executed: break;
0
3155 }-
3156-
3157 bool res = false;-
3158 if (!receiver->isWidgetType()) {
!receiver->isWidgetType()Description
TRUEnever evaluated
FALSEnever evaluated
0
3159 res = d->notify_helper(receiver, e);-
3160 } else switch (e->type()) {
never executed: end of block
0
3161 case QEvent::ShortcutOverride:
never executed: case QEvent::ShortcutOverride:
0
3162 case QEvent::KeyPress:
never executed: case QEvent::KeyPress:
0
3163 case QEvent::KeyRelease:
never executed: case QEvent::KeyRelease:
0
3164 {-
3165 bool isWidget = receiver->isWidgetType();-
3166#ifndef QT_NO_GRAPHICSVIEW-
3167 const bool isGraphicsWidget = !isWidget && qobject_cast<QGraphicsWidget *>(receiver);
!isWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
qobject_cast<Q...t *>(receiver)Description
TRUEnever evaluated
FALSEnever evaluated
0
3168#endif-
3169 QKeyEvent* key = static_cast<QKeyEvent*>(e);-
3170 bool def = key->isAccepted();-
3171 QPointer<QObject> pr = receiver;-
3172 while (receiver) {
receiverDescription
TRUEnever evaluated
FALSEnever evaluated
0
3173 if (def)
defDescription
TRUEnever evaluated
FALSEnever evaluated
0
3174 key->accept();
never executed: key->accept();
0
3175 else-
3176 key->ignore();
never executed: key->ignore();
0
3177 QWidget *w = isWidget ? static_cast<QWidget *>(receiver) : 0;
isWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
3178#ifndef QT_NO_GRAPHICSVIEW-
3179 QGraphicsWidget *gw = isGraphicsWidget ? static_cast<QGraphicsWidget *>(receiver) : 0;
isGraphicsWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
3180#endif-
3181 res = d->notify_helper(receiver, e);-
3182-
3183 if ((res && key->isAccepted())
resDescription
TRUEnever evaluated
FALSEnever evaluated
key->isAccepted()Description
TRUEnever evaluated
FALSEnever evaluated
0
3184 /*-
3185 QLineEdit will emit a signal on Key_Return, but-
3186 ignore the event, and sometimes the connected-
3187 slot deletes the QLineEdit (common in itemview-
3188 delegates), so we have to check if the widget-
3189 was destroyed even if the event was ignored (to-
3190 prevent a crash)-
3191-
3192 note that we don't have to reset pw while-
3193 propagating (because the original receiver will-
3194 be destroyed if one of its ancestors is)-
3195 */-
3196 || !pr
!prDescription
TRUEnever evaluated
FALSEnever evaluated
0
3197 || (isWidget && (w->isWindow() || !w->parentWidget()))
isWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
!w->parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
3198#ifndef QT_NO_GRAPHICSVIEW-
3199 || (isGraphicsWidget && (gw->isWindow() || !gw->parentWidget()))
isGraphicsWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
gw->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
!gw->parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
3200#endif-
3201 ) {-
3202 break;
never executed: break;
0
3203 }-
3204-
3205#ifndef QT_NO_GRAPHICSVIEW-
3206 receiver = w ? (QObject *)w->parentWidget() : (QObject *)gw->parentWidget();
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
3207#else-
3208 receiver = w->parentWidget();-
3209#endif-
3210 }
never executed: end of block
0
3211 qt_in_tab_key_event = false;-
3212 }-
3213 break;
never executed: break;
0
3214 case QEvent::MouseButtonPress:
never executed: case QEvent::MouseButtonPress:
0
3215 case QEvent::MouseButtonRelease:
never executed: case QEvent::MouseButtonRelease:
0
3216 case QEvent::MouseButtonDblClick:
never executed: case QEvent::MouseButtonDblClick:
0
3217 case QEvent::MouseMove:
never executed: case QEvent::MouseMove:
0
3218 {-
3219 QWidget* w = static_cast<QWidget *>(receiver);-
3220-
3221 QMouseEvent* mouse = static_cast<QMouseEvent*>(e);-
3222 QPoint relpos = mouse->pos();-
3223-
3224 if (e->spontaneous()) {
e->spontaneous()Description
TRUEnever evaluated
FALSEnever evaluated
0
3225 if (e->type() != QEvent::MouseMove)
e->type() != QEvent::MouseMoveDescription
TRUEnever evaluated
FALSEnever evaluated
0
3226 QApplicationPrivate::giveFocusAccordingToFocusPolicy(w, e, relpos);
never executed: QApplicationPrivate::giveFocusAccordingToFocusPolicy(w, e, relpos);
0
3227-
3228 // ### Qt 5 These dynamic tool tips should be an OPT-IN feature. Some platforms-
3229 // like OS X (probably others too), can optimize their views by not-
3230 // dispatching mouse move events. We have attributes to control hover,-
3231 // and mouse tracking, but as long as we are deciding to implement this-
3232 // feature without choice of opting-in or out, you ALWAYS have to have-
3233 // tracking enabled. Therefore, the other properties give a false sense of-
3234 // performance enhancement.-
3235 if (e->type() == QEvent::MouseMove && mouse->buttons() == 0
e->type() == QEvent::MouseMoveDescription
TRUEnever evaluated
FALSEnever evaluated
mouse->buttons() == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
3236 && w->rect().contains(relpos)) { // Outside due to mouse grab?
w->rect().contains(relpos)Description
TRUEnever evaluated
FALSEnever evaluated
0
3237 d->toolTipWidget = w;-
3238 d->toolTipPos = relpos;-
3239 d->toolTipGlobalPos = mouse->globalPos();-
3240 QStyle *s = d->toolTipWidget->style();-
3241 int wakeDelay = s->styleHint(QStyle::SH_ToolTip_WakeUpDelay, 0, d->toolTipWidget, 0);-
3242 d->toolTipWakeUp.start(d->toolTipFallAsleep.isActive() ? 20 : wakeDelay, this);-
3243 }
never executed: end of block
0
3244 }
never executed: end of block
0
3245-
3246 bool eventAccepted = mouse->isAccepted();-
3247-
3248 QPointer<QWidget> pw = w;-
3249 while (w) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
3250 QMouseEvent me(mouse->type(), relpos, mouse->windowPos(), mouse->globalPos(),-
3251 mouse->button(), mouse->buttons(), mouse->modifiers(), mouse->source());-
3252 me.spont = mouse->spontaneous();-
3253 me.setTimestamp(mouse->timestamp());-
3254 QGuiApplicationPrivate::setMouseEventFlags(&me, mouse->flags());-
3255 // throw away any mouse-tracking-only mouse events-
3256 if (!w->hasMouseTracking()
!w->hasMouseTracking()Description
TRUEnever evaluated
FALSEnever evaluated
0
3257 && mouse->type() == QEvent::MouseMove && mouse->buttons() == 0) {
mouse->type() ...ent::MouseMoveDescription
TRUEnever evaluated
FALSEnever evaluated
mouse->buttons() == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
3258 // but still send them through all application event filters (normally done by notify_helper)-
3259 for (int i = 0; d->extraData && i < d->extraData->eventFilters.size(); ++i) {
d->extraDataDescription
TRUEnever evaluated
FALSEnever evaluated
i < d->extraDa...Filters.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
3260 QObject *obj = d->extraData->eventFilters.at(i);-
3261 if (!obj)
!objDescription
TRUEnever evaluated
FALSEnever evaluated
0
3262 continue;
never executed: continue;
0
3263 if (Q_UNLIKELY(obj->d_func()->threadData != w->d_func()->threadData)) {
__builtin_expe...dData), false)Description
TRUEnever evaluated
FALSEnever evaluated
0
3264 qWarning("QApplication: Object event filter cannot be in a different thread.");-
3265 continue;
never executed: continue;
0
3266 }-
3267 if (obj->eventFilter(w, w == receiver ? mouse : &me))
obj->eventFilt...? mouse : &me)Description
TRUEnever evaluated
FALSEnever evaluated
0
3268 break;
never executed: break;
0
3269 }
never executed: end of block
0
3270 res = true;-
3271 } else {
never executed: end of block
0
3272 w->setAttribute(Qt::WA_NoMouseReplay, false);-
3273 res = d->notify_helper(w, w == receiver ? mouse : &me);-
3274 e->spont = false;-
3275 }
never executed: end of block
0
3276 eventAccepted = (w == receiver ? mouse : &me)->isAccepted();
w == receiverDescription
TRUEnever evaluated
FALSEnever evaluated
0
3277 if (res && eventAccepted)
resDescription
TRUEnever evaluated
FALSEnever evaluated
eventAcceptedDescription
TRUEnever evaluated
FALSEnever evaluated
0
3278 break;
never executed: break;
0
3279 if (w->isWindow() || w->testAttribute(Qt::WA_NoMousePropagation))
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
w->testAttribu...sePropagation)Description
TRUEnever evaluated
FALSEnever evaluated
0
3280 break;
never executed: break;
0
3281 relpos += w->pos();-
3282 w = w->parentWidget();-
3283 }
never executed: end of block
0
3284-
3285 mouse->setAccepted(eventAccepted);-
3286-
3287 if (e->type() == QEvent::MouseMove) {
e->type() == QEvent::MouseMoveDescription
TRUEnever evaluated
FALSEnever evaluated
0
3288 if (!pw)
!pwDescription
TRUEnever evaluated
FALSEnever evaluated
0
3289 break;
never executed: break;
0
3290-
3291 w = static_cast<QWidget *>(receiver);-
3292 relpos = mouse->pos();-
3293 QPoint diff = relpos - w->mapFromGlobal(d->hoverGlobalPos);-
3294 while (w) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
3295 if (w->testAttribute(Qt::WA_Hover) &&
w->testAttribute(Qt::WA_Hover)Description
TRUEnever evaluated
FALSEnever evaluated
0
3296 (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) {
!QApplication:...ePopupWidget()Description
TRUEnever evaluated
FALSEnever evaluated
QApplication::...== w->window()Description
TRUEnever evaluated
FALSEnever evaluated
0
3297 QHoverEvent he(QEvent::HoverMove, relpos, relpos - diff, mouse->modifiers());-
3298 d->notify_helper(w, &he);-
3299 }
never executed: end of block
0
3300 if (w->isWindow() || w->testAttribute(Qt::WA_NoMousePropagation))
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
w->testAttribu...sePropagation)Description
TRUEnever evaluated
FALSEnever evaluated
0
3301 break;
never executed: break;
0
3302 relpos += w->pos();-
3303 w = w->parentWidget();-
3304 }
never executed: end of block
0
3305 }
never executed: end of block
0
3306-
3307 d->hoverGlobalPos = mouse->globalPos();-
3308 }-
3309 break;
never executed: break;
0
3310#ifndef QT_NO_WHEELEVENT-
3311 case QEvent::Wheel:
never executed: case QEvent::Wheel:
0
3312 {-
3313 QWidget* w = static_cast<QWidget *>(receiver);-
3314-
3315 // QTBUG-40656, QTBUG-42731: ignore wheel events when a popup (QComboBox) is open.-
3316 if (const QWidget *popup = QApplication::activePopupWidget()) {
const QWidget ...ePopupWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
3317 if (w->window() != popup)
w->window() != popupDescription
TRUEnever evaluated
FALSEnever evaluated
0
3318 return true;
never executed: return true;
0
3319 }
never executed: end of block
0
3320-
3321 QWheelEvent* wheel = static_cast<QWheelEvent*>(e);-
3322 const bool spontaneous = wheel->spontaneous();-
3323 const Qt::ScrollPhase phase = wheel->phase();-
3324-
3325 // Ideally, we should lock on a widget when it starts receiving wheel-
3326 // events. This avoids other widgets to start receiving those events-
3327 // as the mouse cursor hovers them. However, given the way common-
3328 // wheeled mice work, there's no certain way of connecting different-
3329 // wheel events as a stream. This results in the NoScrollPhase case,-
3330 // where we just send the event from the original receiver and up its-
3331 // hierarchy until the event gets accepted.-
3332 //-
3333 // In the case of more evolved input devices, like Apple's trackpad or-
3334 // Magic Mouse, we receive the scroll phase information. This helps us-
3335 // connect wheel events as a stream and therefore makes it easier to-
3336 // lock on the widget onto which the scrolling was initiated.-
3337 //-
3338 // We assume that, when supported, the phase cycle follows the pattern:-
3339 //-
3340 // ScrollBegin (ScrollUpdate* ScrollEnd)+-
3341 //-
3342 // This means that we can have scrolling sequences (starting with ScrollBegin)-
3343 // or partial sequences (after a ScrollEnd and starting with ScrollUpdate).-
3344 // If wheel_widget is null because it was deleted, we also take the same-
3345 // code path as an initial sequence.-
3346 if (phase == Qt::NoScrollPhase || phase == Qt::ScrollBegin || !QApplicationPrivate::wheel_widget) {
phase == Qt::NoScrollPhaseDescription
TRUEnever evaluated
FALSEnever evaluated
phase == Qt::ScrollBeginDescription
TRUEnever evaluated
FALSEnever evaluated
!QApplicationP...::wheel_widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
3347-
3348 // A system-generated ScrollBegin event starts a new user scrolling-
3349 // sequence, so we reset wheel_widget in case no one accepts the event-
3350 // or if we didn't get (or missed) a ScrollEnd previously.-
3351 if (spontaneous && phase == Qt::ScrollBegin)
spontaneousDescription
TRUEnever evaluated
FALSEnever evaluated
phase == Qt::ScrollBeginDescription
TRUEnever evaluated
FALSEnever evaluated
0
3352 QApplicationPrivate::wheel_widget = Q_NULLPTR;
never executed: QApplicationPrivate::wheel_widget = nullptr;
0
3353-
3354 const QPoint &relpos = wheel->pos();-
3355-
3356 if (spontaneous && (phase == Qt::NoScrollPhase || phase == Qt::ScrollUpdate))
spontaneousDescription
TRUEnever evaluated
FALSEnever evaluated
phase == Qt::NoScrollPhaseDescription
TRUEnever evaluated
FALSEnever evaluated
phase == Qt::ScrollUpdateDescription
TRUEnever evaluated
FALSEnever evaluated
0
3357 QApplicationPrivate::giveFocusAccordingToFocusPolicy(w, e, relpos);
never executed: QApplicationPrivate::giveFocusAccordingToFocusPolicy(w, e, relpos);
0
3358-
3359 QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(),-
3360 wheel->modifiers(), phase, wheel->source(), wheel->inverted());-
3361 bool eventAccepted;-
3362 while (w) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
3363 we.spont = spontaneous && w == receiver;
spontaneousDescription
TRUEnever evaluated
FALSEnever evaluated
w == receiverDescription
TRUEnever evaluated
FALSEnever evaluated
0
3364 we.ignore();-
3365 res = d->notify_helper(w, &we);-
3366 eventAccepted = we.isAccepted();-
3367 if (res && eventAccepted) {
resDescription
TRUEnever evaluated
FALSEnever evaluated
eventAcceptedDescription
TRUEnever evaluated
FALSEnever evaluated
0
3368 // A new scrolling sequence or partial sequence starts and w has accepted-
3369 // the event. Therefore, we can set wheel_widget, but only if it's not-
3370 // the end of a sequence.-
3371 if (spontaneous && (phase == Qt::ScrollBegin || phase == Qt::ScrollUpdate))
spontaneousDescription
TRUEnever evaluated
FALSEnever evaluated
phase == Qt::ScrollBeginDescription
TRUEnever evaluated
FALSEnever evaluated
phase == Qt::ScrollUpdateDescription
TRUEnever evaluated
FALSEnever evaluated
0
3372 QApplicationPrivate::wheel_widget = w;
never executed: QApplicationPrivate::wheel_widget = w;
0
3373 break;
never executed: break;
0
3374 }-
3375 if (w->isWindow() || w->testAttribute(Qt::WA_NoMousePropagation))
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
w->testAttribu...sePropagation)Description
TRUEnever evaluated
FALSEnever evaluated
0
3376 break;
never executed: break;
0
3377-
3378 we.p += w->pos();-
3379 w = w->parentWidget();-
3380 }
never executed: end of block
0
3381 wheel->setAccepted(eventAccepted);-
3382 } else if (!spontaneous) {
never executed: end of block
!spontaneousDescription
TRUEnever evaluated
FALSEnever evaluated
0
3383 // wheel_widget may forward the wheel event to a delegate widget,-
3384 // either directly or indirectly (e.g. QAbstractScrollArea will-
3385 // forward to its QScrollBars through viewportEvent()). In that-
3386 // case, the event will not be spontaneous but synthesized, so-
3387 // we can send it straight to the receiver.-
3388 d->notify_helper(w, wheel);-
3389 } else {
never executed: end of block
0
3390 // The phase is either ScrollUpdate or ScrollEnd, and wheel_widget-
3391 // is set. Since it accepted the wheel event previously, we continue-
3392 // sending those events until we get a ScrollEnd, which signifies-
3393 // the end of the natural scrolling sequence.-
3394 const QPoint &relpos = QApplicationPrivate::wheel_widget->mapFromGlobal(wheel->globalPos());-
3395 QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(),-
3396 wheel->modifiers(), wheel->phase(), wheel->source());-
3397 we.spont = true;-
3398 we.ignore();-
3399 d->notify_helper(QApplicationPrivate::wheel_widget, &we);-
3400 wheel->setAccepted(we.isAccepted());-
3401 if (phase == Qt::ScrollEnd)
phase == Qt::ScrollEndDescription
TRUEnever evaluated
FALSEnever evaluated
0
3402 QApplicationPrivate::wheel_widget = Q_NULLPTR;
never executed: QApplicationPrivate::wheel_widget = nullptr;
0
3403 }
never executed: end of block
0
3404 }-
3405 break;
never executed: break;
0
3406#endif-
3407#ifndef QT_NO_CONTEXTMENU-
3408 case QEvent::ContextMenu:
never executed: case QEvent::ContextMenu:
0
3409 {-
3410 QWidget* w = static_cast<QWidget *>(receiver);-
3411 QContextMenuEvent *context = static_cast<QContextMenuEvent*>(e);-
3412 QPoint relpos = context->pos();-
3413 bool eventAccepted = context->isAccepted();-
3414 while (w) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
3415 QContextMenuEvent ce(context->reason(), relpos, context->globalPos(), context->modifiers());-
3416 ce.spont = e->spontaneous();-
3417 res = d->notify_helper(w, w == receiver ? context : &ce);-
3418 eventAccepted = ((w == receiver) ? context : &ce)->isAccepted();
(w == receiver)Description
TRUEnever evaluated
FALSEnever evaluated
0
3419 e->spont = false;-
3420-
3421 if ((res && eventAccepted)
resDescription
TRUEnever evaluated
FALSEnever evaluated
eventAcceptedDescription
TRUEnever evaluated
FALSEnever evaluated
0
3422 || w->isWindow() || w->testAttribute(Qt::WA_NoMousePropagation))
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
w->testAttribu...sePropagation)Description
TRUEnever evaluated
FALSEnever evaluated
0
3423 break;
never executed: break;
0
3424-
3425 relpos += w->pos();-
3426 w = w->parentWidget();-
3427 }
never executed: end of block
0
3428 context->setAccepted(eventAccepted);-
3429 }-
3430 break;
never executed: break;
0
3431#endif // QT_NO_CONTEXTMENU-
3432#ifndef QT_NO_TABLETEVENT-
3433 case QEvent::TabletMove:
never executed: case QEvent::TabletMove:
0
3434 case QEvent::TabletPress:
never executed: case QEvent::TabletPress:
0
3435 case QEvent::TabletRelease:
never executed: case QEvent::TabletRelease:
0
3436 {-
3437 QWidget *w = static_cast<QWidget *>(receiver);-
3438 QTabletEvent *tablet = static_cast<QTabletEvent*>(e);-
3439 QPointF relpos = tablet->posF();-
3440 bool eventAccepted = tablet->isAccepted();-
3441 while (w) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
3442 QTabletEvent te(tablet->type(), relpos, tablet->globalPosF(),-
3443 tablet->device(), tablet->pointerType(),-
3444 tablet->pressure(), tablet->xTilt(), tablet->yTilt(),-
3445 tablet->tangentialPressure(), tablet->rotation(), tablet->z(),-
3446 tablet->modifiers(), tablet->uniqueId(), tablet->button(), tablet->buttons());-
3447 te.spont = e->spontaneous();-
3448 res = d->notify_helper(w, w == receiver ? tablet : &te);-
3449 eventAccepted = ((w == receiver) ? tablet : &te)->isAccepted();
(w == receiver)Description
TRUEnever evaluated
FALSEnever evaluated
0
3450 e->spont = false;-
3451 if ((res && eventAccepted)
resDescription
TRUEnever evaluated
FALSEnever evaluated
eventAcceptedDescription
TRUEnever evaluated
FALSEnever evaluated
0
3452 || w->isWindow()
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
3453 || w->testAttribute(Qt::WA_NoMousePropagation))
w->testAttribu...sePropagation)Description
TRUEnever evaluated
FALSEnever evaluated
0
3454 break;
never executed: break;
0
3455-
3456 relpos += w->pos();-
3457 w = w->parentWidget();-
3458 }
never executed: end of block
0
3459 tablet->setAccepted(eventAccepted);-
3460 }-
3461 break;
never executed: break;
0
3462#endif // QT_NO_TABLETEVENT-
3463-
3464#if !defined(QT_NO_TOOLTIP) || !defined(QT_NO_WHATSTHIS)-
3465 case QEvent::ToolTip:
never executed: case QEvent::ToolTip:
0
3466 case QEvent::WhatsThis:
never executed: case QEvent::WhatsThis:
0
3467 case QEvent::QueryWhatsThis:
never executed: case QEvent::QueryWhatsThis:
0
3468 {-
3469 QWidget* w = static_cast<QWidget *>(receiver);-
3470 QHelpEvent *help = static_cast<QHelpEvent*>(e);-
3471 QPoint relpos = help->pos();-
3472 bool eventAccepted = help->isAccepted();-
3473 while (w) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
3474 QHelpEvent he(help->type(), relpos, help->globalPos());-
3475 he.spont = e->spontaneous();-
3476 res = d->notify_helper(w, w == receiver ? help : &he);-
3477 e->spont = false;-
3478 eventAccepted = (w == receiver ? help : &he)->isAccepted();
w == receiverDescription
TRUEnever evaluated
FALSEnever evaluated
0
3479 if ((res && eventAccepted) || w->isWindow())
resDescription
TRUEnever evaluated
FALSEnever evaluated
eventAcceptedDescription
TRUEnever evaluated
FALSEnever evaluated
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
3480 break;
never executed: break;
0
3481-
3482 relpos += w->pos();-
3483 w = w->parentWidget();-
3484 }
never executed: end of block
0
3485 help->setAccepted(eventAccepted);-
3486 }-
3487 break;
never executed: break;
0
3488#endif-
3489#if !defined(QT_NO_STATUSTIP) || !defined(QT_NO_WHATSTHIS)-
3490 case QEvent::StatusTip:
never executed: case QEvent::StatusTip:
0
3491 case QEvent::WhatsThisClicked:
never executed: case QEvent::WhatsThisClicked:
0
3492 {-
3493 QWidget *w = static_cast<QWidget *>(receiver);-
3494 while (w) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
3495 res = d->notify_helper(w, e);-
3496 if ((res && e->isAccepted()) || w->isWindow())
resDescription
TRUEnever evaluated
FALSEnever evaluated
e->isAccepted()Description
TRUEnever evaluated
FALSEnever evaluated
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
3497 break;
never executed: break;
0
3498 w = w->parentWidget();-
3499 }
never executed: end of block
0
3500 }-
3501 break;
never executed: break;
0
3502#endif-
3503-
3504#ifndef QT_NO_DRAGANDDROP-
3505 case QEvent::DragEnter: {
never executed: case QEvent::DragEnter:
0
3506 QWidget* w = static_cast<QWidget *>(receiver);-
3507 QDragEnterEvent *dragEvent = static_cast<QDragEnterEvent *>(e);-
3508#ifndef QT_NO_GRAPHICSVIEW-
3509 // QGraphicsProxyWidget handles its own propagation,-
3510 // and we must not change QDragManagers currentTarget.-
3511 QWExtra *extra = w->window()->d_func()->extra;-
3512 if (extra && extra->proxyWidget) {
extraDescription
TRUEnever evaluated
FALSEnever evaluated
extra->proxyWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
3513 res = d->notify_helper(w, dragEvent);-
3514 break;
never executed: break;
0
3515 }-
3516#endif-
3517 while (w) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
3518 if (w->isEnabled() && w->acceptDrops()) {
w->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
w->acceptDrops()Description
TRUEnever evaluated
FALSEnever evaluated
0
3519 res = d->notify_helper(w, dragEvent);-
3520 if (res && dragEvent->isAccepted()) {
resDescription
TRUEnever evaluated
FALSEnever evaluated
dragEvent->isAccepted()Description
TRUEnever evaluated
FALSEnever evaluated
0
3521 QDragManager::self()->setCurrentTarget(w);-
3522 break;
never executed: break;
0
3523 }-
3524 }
never executed: end of block
0
3525 if (w->isWindow())
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
3526 break;
never executed: break;
0
3527 dragEvent->p = w->mapToParent(dragEvent->p.toPoint());-
3528 w = w->parentWidget();-
3529 }
never executed: end of block
0
3530 }-
3531 break;
never executed: break;
0
3532 case QEvent::DragMove:
never executed: case QEvent::DragMove:
0
3533 case QEvent::Drop:
never executed: case QEvent::Drop:
0
3534 case QEvent::DragLeave: {
never executed: case QEvent::DragLeave:
0
3535 QWidget* w = static_cast<QWidget *>(receiver);-
3536#ifndef QT_NO_GRAPHICSVIEW-
3537 // QGraphicsProxyWidget handles its own propagation,-
3538 // and we must not change QDragManagers currentTarget.-
3539 QWExtra *extra = w->window()->d_func()->extra;-
3540 bool isProxyWidget = extra && extra->proxyWidget;
extraDescription
TRUEnever evaluated
FALSEnever evaluated
extra->proxyWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
3541 if (!isProxyWidget)
!isProxyWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
3542#endif-
3543 w = qobject_cast<QWidget *>(QDragManager::self()->currentTarget());
never executed: w = qobject_cast<QWidget *>(QDragManager::self()->currentTarget());
0
3544-
3545 if (!w) {
!wDescription
TRUEnever evaluated
FALSEnever evaluated
0
3546 break;
never executed: break;
0
3547 }-
3548 if (e->type() == QEvent::DragMove || e->type() == QEvent::Drop) {
e->type() == QEvent::DragMoveDescription
TRUEnever evaluated
FALSEnever evaluated
e->type() == QEvent::DropDescription
TRUEnever evaluated
FALSEnever evaluated
0
3549 QDropEvent *dragEvent = static_cast<QDropEvent *>(e);-
3550 QWidget *origReciver = static_cast<QWidget *>(receiver);-
3551 while (origReciver && w != origReciver) {
origReciverDescription
TRUEnever evaluated
FALSEnever evaluated
w != origReciverDescription
TRUEnever evaluated
FALSEnever evaluated
0
3552 dragEvent->p = origReciver->mapToParent(dragEvent->p.toPoint());-
3553 origReciver = origReciver->parentWidget();-
3554 }
never executed: end of block
0
3555 }
never executed: end of block
0
3556 res = d->notify_helper(w, e);-
3557 if (e->type() != QEvent::DragMove
e->type() != QEvent::DragMoveDescription
TRUEnever evaluated
FALSEnever evaluated
0
3558#ifndef QT_NO_GRAPHICSVIEW-
3559 && !isProxyWidget
!isProxyWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
3560#endif-
3561 )-
3562 QDragManager::self()->setCurrentTarget(0, e->type() == QEvent::Drop);
never executed: QDragManager::self()->setCurrentTarget(0, e->type() == QEvent::Drop);
0
3563 }-
3564 break;
never executed: break;
0
3565#endif-
3566 case QEvent::TouchBegin:
never executed: case QEvent::TouchBegin:
0
3567 // Note: TouchUpdate and TouchEnd events are never propagated-
3568 {-
3569 QWidget *widget = static_cast<QWidget *>(receiver);-
3570 QTouchEvent *touchEvent = static_cast<QTouchEvent *>(e);-
3571 bool eventAccepted = touchEvent->isAccepted();-
3572 bool acceptTouchEvents = widget->testAttribute(Qt::WA_AcceptTouchEvents);-
3573-
3574 if (acceptTouchEvents && e->spontaneous()) {
acceptTouchEventsDescription
TRUEnever evaluated
FALSEnever evaluated
e->spontaneous()Description
TRUEnever evaluated
FALSEnever evaluated
0
3575 const QPoint localPos = touchEvent->touchPoints()[0].pos().toPoint();-
3576 QApplicationPrivate::giveFocusAccordingToFocusPolicy(widget, e, localPos);-
3577 }
never executed: end of block
0
3578-
3579#ifndef QT_NO_GESTURES-
3580 QPointer<QWidget> gesturePendingWidget;-
3581#endif-
3582-
3583 while (widget) {
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
3584 // first, try to deliver the touch event-
3585 acceptTouchEvents = widget->testAttribute(Qt::WA_AcceptTouchEvents);-
3586 touchEvent->setTarget(widget);-
3587 touchEvent->setAccepted(acceptTouchEvents);-
3588 QPointer<QWidget> p = widget;-
3589 res = acceptTouchEvents && d->notify_helper(widget, touchEvent);
acceptTouchEventsDescription
TRUEnever evaluated
FALSEnever evaluated
d->notify_help...t, touchEvent)Description
TRUEnever evaluated
FALSEnever evaluated
0
3590 eventAccepted = touchEvent->isAccepted();-
3591 if (p.isNull()) {
p.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
3592 // widget was deleted-
3593 widget = 0;-
3594 } else {
never executed: end of block
0
3595 widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, res && eventAccepted);-
3596 }
never executed: end of block
0
3597 touchEvent->spont = false;-
3598 if (res && eventAccepted) {
resDescription
TRUEnever evaluated
FALSEnever evaluated
eventAcceptedDescription
TRUEnever evaluated
FALSEnever evaluated
0
3599 // the first widget to accept the TouchBegin gets an implicit grab.-
3600 d->activateImplicitTouchGrab(widget, touchEvent);-
3601 break;
never executed: break;
0
3602 }-
3603#ifndef QT_NO_GESTURES-
3604 if (gesturePendingWidget.isNull() && widget && QGestureManager::gesturePending(widget))
gesturePendingWidget.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
QGestureManage...ending(widget)Description
TRUEnever evaluated
FALSEnever evaluated
0
3605 gesturePendingWidget = widget;
never executed: gesturePendingWidget = widget;
0
3606#endif-
3607 if (p.isNull() || widget->isWindow() || widget->testAttribute(Qt::WA_NoMousePropagation))
p.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
widget->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
widget->testAt...sePropagation)Description
TRUEnever evaluated
FALSEnever evaluated
0
3608 break;
never executed: break;
0
3609-
3610 QPoint offset = widget->pos();-
3611 widget = widget->parentWidget();-
3612 touchEvent->setTarget(widget);-
3613 for (int i = 0; i < touchEvent->_touchPoints.size(); ++i) {
i < touchEvent...hPoints.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
3614 QTouchEvent::TouchPoint &pt = touchEvent->_touchPoints[i];-
3615 QRectF rect = pt.rect();-
3616 rect.translate(offset);-
3617 pt.d->rect = rect;-
3618 pt.d->startPos = pt.startPos() + offset;-
3619 pt.d->lastPos = pt.lastPos() + offset;-
3620 }
never executed: end of block
0
3621 }
never executed: end of block
0
3622-
3623#ifndef QT_NO_GESTURES-
3624 if (!eventAccepted && !gesturePendingWidget.isNull()) {
!eventAcceptedDescription
TRUEnever evaluated
FALSEnever evaluated
!gesturePendingWidget.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
3625 // the first widget subscribed to a gesture gets an implicit grab-
3626 d->activateImplicitTouchGrab(gesturePendingWidget, touchEvent);-
3627 }
never executed: end of block
0
3628#endif-
3629-
3630 touchEvent->setAccepted(eventAccepted);-
3631 break;
never executed: break;
0
3632 }-
3633 case QEvent::TouchUpdate:
never executed: case QEvent::TouchUpdate:
0
3634 case QEvent::TouchEnd:
never executed: case QEvent::TouchEnd:
0
3635 {-
3636 QWidget *widget = static_cast<QWidget *>(receiver);-
3637 // We may get here if the widget is subscribed to a gesture,-
3638 // but has not accepted TouchBegin. Propagate touch events-
3639 // only if TouchBegin has been accepted.-
3640 if (widget && widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent))
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
widget->testAt...uchBeginEvent)Description
TRUEnever evaluated
FALSEnever evaluated
0
3641 res = d->notify_helper(widget, e);
never executed: res = d->notify_helper(widget, e);
0
3642 break;
never executed: break;
0
3643 }-
3644 case QEvent::RequestSoftwareInputPanel:
never executed: case QEvent::RequestSoftwareInputPanel:
0
3645 inputMethod()->show();-
3646 break;
never executed: break;
0
3647 case QEvent::CloseSoftwareInputPanel:
never executed: case QEvent::CloseSoftwareInputPanel:
0
3648 inputMethod()->hide();-
3649 break;
never executed: break;
0
3650-
3651#ifndef QT_NO_GESTURES-
3652 case QEvent::NativeGesture:
never executed: case QEvent::NativeGesture:
0
3653 {-
3654 // only propagate the first gesture event (after the GID_BEGIN)-
3655 QWidget *w = static_cast<QWidget *>(receiver);-
3656 while (w) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
3657 e->ignore();-
3658 res = d->notify_helper(w, e);-
3659 if ((res && e->isAccepted()) || w->isWindow())
resDescription
TRUEnever evaluated
FALSEnever evaluated
e->isAccepted()Description
TRUEnever evaluated
FALSEnever evaluated
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
3660 break;
never executed: break;
0
3661 w = w->parentWidget();-
3662 }
never executed: end of block
0
3663 break;
never executed: break;
0
3664 }-
3665 case QEvent::Gesture:
never executed: case QEvent::Gesture:
0
3666 case QEvent::GestureOverride:
never executed: case QEvent::GestureOverride:
0
3667 {-
3668 if (receiver->isWidgetType()) {
receiver->isWidgetType()Description
TRUEnever evaluated
FALSEnever evaluated
0
3669 QWidget *w = static_cast<QWidget *>(receiver);-
3670 QGestureEvent *gestureEvent = static_cast<QGestureEvent *>(e);-
3671 QList<QGesture *> allGestures = gestureEvent->gestures();-
3672-
3673 bool eventAccepted = gestureEvent->isAccepted();-
3674 bool wasAccepted = eventAccepted;-
3675 while (w) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
3676 // send only gestures the widget expects-
3677 QList<QGesture *> gestures;-
3678 QWidgetPrivate *wd = w->d_func();-
3679 for (int i = 0; i < allGestures.size();) {
i < allGestures.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
3680 QGesture *g = allGestures.at(i);-
3681 Qt::GestureType type = g->gestureType();-
3682 QMap<Qt::GestureType, Qt::GestureFlags>::iterator contextit =-
3683 wd->gestureContext.find(type);-
3684 bool deliver = contextit != wd->gestureContext.end() &&
contextit != w...eContext.end()Description
TRUEnever evaluated
FALSEnever evaluated
0
3685 (g->state() == Qt::GestureStarted || w == receiver ||
g->state() == ...GestureStartedDescription
TRUEnever evaluated
FALSEnever evaluated
w == receiverDescription
TRUEnever evaluated
FALSEnever evaluated
0
3686 (contextit.value() & Qt::ReceivePartialGestures));
(contextit.val...rtialGestures)Description
TRUEnever evaluated
FALSEnever evaluated
0
3687 if (deliver) {
deliverDescription
TRUEnever evaluated
FALSEnever evaluated
0
3688 allGestures.removeAt(i);-
3689 gestures.append(g);-
3690 } else {
never executed: end of block
0
3691 ++i;-
3692 }
never executed: end of block
0
3693 }-
3694 if (!gestures.isEmpty()) { // we have gestures for this w
!gestures.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
3695 QGestureEvent ge(gestures);-
3696 ge.t = gestureEvent->t;-
3697 ge.spont = gestureEvent->spont;-
3698 ge.m_accept = wasAccepted;-
3699 ge.m_accepted = gestureEvent->m_accepted;-
3700 res = d->notify_helper(w, &ge);-
3701 gestureEvent->spont = false;-
3702 eventAccepted = ge.isAccepted();-
3703 for (int i = 0; i < gestures.size(); ++i) {
i < gestures.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
3704 QGesture *g = gestures.at(i);-
3705 // Ignore res [event return value] because handling of multiple gestures-
3706 // packed into a single QEvent depends on not consuming the event-
3707 if (eventAccepted || ge.isAccepted(g)) {
eventAcceptedDescription
TRUEnever evaluated
FALSEnever evaluated
ge.isAccepted(g)Description
TRUEnever evaluated
FALSEnever evaluated
0
3708 // if the gesture was accepted, mark the target widget for it-
3709 gestureEvent->m_targetWidgets[g->gestureType()] = w;-
3710 gestureEvent->setAccepted(g, true);-
3711 } else {
never executed: end of block
0
3712 // if the gesture was explicitly ignored by the application,-
3713 // put it back so a parent can get it-
3714 allGestures.append(g);-
3715 }
never executed: end of block
0
3716 }-
3717 }
never executed: end of block
0
3718 if (allGestures.isEmpty()) // everything delivered
allGestures.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
3719 break;
never executed: break;
0
3720 if (w->isWindow())
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
3721 break;
never executed: break;
0
3722 w = w->parentWidget();-
3723 }
never executed: end of block
0
3724 foreach (QGesture *g, allGestures)-
3725 gestureEvent->setAccepted(g, false);
never executed: gestureEvent->setAccepted(g, false);
0
3726 gestureEvent->m_accept = false; // to make sure we check individual gestures-
3727 } else {
never executed: end of block
0
3728 res = d->notify_helper(receiver, e);-
3729 }
never executed: end of block
0
3730 break;
never executed: break;
0
3731 }-
3732#endif // QT_NO_GESTURES-
3733#ifdef Q_OS_MAC-
3734 // Enable touch events on enter, disable on leave.-
3735 typedef void (*RegisterTouchWindowFn)(QWindow *, bool);-
3736 case QEvent::Enter:-
3737 if (receiver->isWidgetType()) {-
3738 QWidget *w = static_cast<QWidget *>(receiver);-
3739 if (w->testAttribute(Qt::WA_AcceptTouchEvents)) {-
3740 RegisterTouchWindowFn registerTouchWindow = reinterpret_cast<RegisterTouchWindowFn>-
3741 (platformNativeInterface()->nativeResourceFunctionForIntegration("registertouchwindow"));-
3742 if (registerTouchWindow)-
3743 registerTouchWindow(w->window()->windowHandle(), true);-
3744 }-
3745 }-
3746 res = d->notify_helper(receiver, e);-
3747 break;-
3748 case QEvent::Leave:-
3749 if (receiver->isWidgetType()) {-
3750 QWidget *w = static_cast<QWidget *>(receiver);-
3751 if (w->testAttribute(Qt::WA_AcceptTouchEvents)) {-
3752 RegisterTouchWindowFn registerTouchWindow = reinterpret_cast<RegisterTouchWindowFn>-
3753 (platformNativeInterface()->nativeResourceFunctionForIntegration("registertouchwindow"));-
3754 if (registerTouchWindow)-
3755 registerTouchWindow(w->window()->windowHandle(), false);-
3756 }-
3757 }-
3758 res = d->notify_helper(receiver, e);-
3759 break;-
3760#endif-
3761 default:
never executed: default:
0
3762 res = d->notify_helper(receiver, e);-
3763 break;
never executed: break;
0
3764 }-
3765-
3766 return res;
never executed: return res;
0
3767}-
3768-
3769bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)-
3770{-
3771 // send to all application event filters-
3772 if (threadRequiresCoreApplication()
threadRequires...eApplication()Description
TRUEnever evaluated
FALSEnever evaluated
0
3773 && receiver->d_func()->threadData->thread == mainThread()
receiver->d_fu...= mainThread()Description
TRUEnever evaluated
FALSEnever evaluated
0
3774 && sendThroughApplicationEventFilters(receiver, e))
sendThroughApp...s(receiver, e)Description
TRUEnever evaluated
FALSEnever evaluated
0
3775 return true;
never executed: return true;
0
3776-
3777 if (receiver->isWidgetType()) {
receiver->isWidgetType()Description
TRUEnever evaluated
FALSEnever evaluated
0
3778 QWidget *widget = static_cast<QWidget *>(receiver);-
3779-
3780#if !defined(Q_OS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR))-
3781 // toggle HasMouse widget state on enter and leave-
3782 if ((e->type() == QEvent::Enter || e->type() == QEvent::DragEnter) &&
e->type() == QEvent::EnterDescription
TRUEnever evaluated
FALSEnever evaluated
e->type() == QEvent::DragEnterDescription
TRUEnever evaluated
FALSEnever evaluated
0
3783 (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == widget->window()))
!QApplication:...ePopupWidget()Description
TRUEnever evaluated
FALSEnever evaluated
QApplication::...dget->window()Description
TRUEnever evaluated
FALSEnever evaluated
0
3784 widget->setAttribute(Qt::WA_UnderMouse, true);
never executed: widget->setAttribute(Qt::WA_UnderMouse, true);
0
3785 else if (e->type() == QEvent::Leave || e->type() == QEvent::DragLeave)
e->type() == QEvent::LeaveDescription
TRUEnever evaluated
FALSEnever evaluated
e->type() == QEvent::DragLeaveDescription
TRUEnever evaluated
FALSEnever evaluated
0
3786 widget->setAttribute(Qt::WA_UnderMouse, false);
never executed: widget->setAttribute(Qt::WA_UnderMouse, false);
0
3787#endif-
3788-
3789 if (QLayout *layout=widget->d_func()->layout) {
QLayout *layou...func()->layoutDescription
TRUEnever evaluated
FALSEnever evaluated
0
3790 layout->widgetEvent(e);-
3791 }
never executed: end of block
0
3792 }
never executed: end of block
0
3793-
3794 // send to all receiver event filters-
3795 if (sendThroughObjectEventFilters(receiver, e))
sendThroughObj...s(receiver, e)Description
TRUEnever evaluated
FALSEnever evaluated
0
3796 return true;
never executed: return true;
0
3797-
3798 // deliver the event-
3799 bool consumed = receiver->event(e);-
3800 QCoreApplicationPrivate::setEventSpontaneous(e, false);-
3801 return consumed;
never executed: return consumed;
0
3802}-
3803-
3804bool QApplicationPrivate::inPopupMode()-
3805{-
3806 return QApplicationPrivate::popupWidgets != 0;
never executed: return QApplicationPrivate::popupWidgets != 0;
0
3807}-
3808-
3809static void ungrabKeyboardForPopup(QWidget *popup)-
3810{-
3811 if (QWidget::keyboardGrabber())
QWidget::keyboardGrabber()Description
TRUEnever evaluated
FALSEnever evaluated
0
3812 qt_widget_private(QWidget::keyboardGrabber())->stealKeyboardGrab(true);
never executed: qt_widget_private(QWidget::keyboardGrabber())->stealKeyboardGrab(true);
0
3813 else-
3814 qt_widget_private(popup)->stealKeyboardGrab(false);
never executed: qt_widget_private(popup)->stealKeyboardGrab(false);
0
3815}-
3816-
3817static void ungrabMouseForPopup(QWidget *popup)-
3818{-
3819 if (QWidget::mouseGrabber())
QWidget::mouseGrabber()Description
TRUEnever evaluated
FALSEnever evaluated
0
3820 qt_widget_private(QWidget::mouseGrabber())->stealMouseGrab(true);
never executed: qt_widget_private(QWidget::mouseGrabber())->stealMouseGrab(true);
0
3821 else-
3822 qt_widget_private(popup)->stealMouseGrab(false);
never executed: qt_widget_private(popup)->stealMouseGrab(false);
0
3823}-
3824-
3825static bool popupGrabOk;-
3826-
3827static void grabForPopup(QWidget *popup)-
3828{-
3829 Q_ASSERT(popup->testAttribute(Qt::WA_WState_Created));-
3830 popupGrabOk = qt_widget_private(popup)->stealKeyboardGrab(true);-
3831 if (popupGrabOk) {
popupGrabOkDescription
TRUEnever evaluated
FALSEnever evaluated
0
3832 popupGrabOk = qt_widget_private(popup)->stealMouseGrab(true);-
3833 if (!popupGrabOk) {
!popupGrabOkDescription
TRUEnever evaluated
FALSEnever evaluated
0
3834 // transfer grab back to the keyboard grabber if any-
3835 ungrabKeyboardForPopup(popup);-
3836 }
never executed: end of block
0
3837 }
never executed: end of block
0
3838}
never executed: end of block
0
3839-
3840extern QWidget *qt_button_down;-
3841extern QWidget *qt_popup_down;-
3842extern bool qt_replay_popup_mouse_event;-
3843-
3844void QApplicationPrivate::closePopup(QWidget *popup)-
3845{-
3846 if (!popupWidgets)
!popupWidgetsDescription
TRUEnever evaluated
FALSEnever evaluated
0
3847 return;
never executed: return;
0
3848 popupWidgets->removeAll(popup);-
3849-
3850 if (popup == qt_popup_down) {
popup == qt_popup_downDescription
TRUEnever evaluated
FALSEnever evaluated
0
3851 qt_button_down = 0;-
3852 qt_popup_down = 0;-
3853 }
never executed: end of block
0
3854-
3855 if (QApplicationPrivate::popupWidgets->count() == 0) { // this was the last popup
QApplicationPr...->count() == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
3856 delete QApplicationPrivate::popupWidgets;-
3857 QApplicationPrivate::popupWidgets = 0;-
3858-
3859 if (popupGrabOk) {
popupGrabOkDescription
TRUEnever evaluated
FALSEnever evaluated
0
3860 popupGrabOk = false;-
3861-
3862 if (popup->geometry().contains(QPoint(QGuiApplicationPrivate::mousePressX,
popup->geometr...:mousePressY))Description
TRUEnever evaluated
FALSEnever evaluated
0
3863 QGuiApplicationPrivate::mousePressY))
popup->geometr...:mousePressY))Description
TRUEnever evaluated
FALSEnever evaluated
0
3864 || popup->testAttribute(Qt::WA_NoMouseReplay)) {
popup->testAtt...NoMouseReplay)Description
TRUEnever evaluated
FALSEnever evaluated
0
3865 // mouse release event or inside-
3866 qt_replay_popup_mouse_event = false;-
3867 } else { // mouse press event
never executed: end of block
0
3868 qt_replay_popup_mouse_event = true;-
3869 }
never executed: end of block
0
3870-
3871 // transfer grab back to mouse grabber if any, otherwise release the grab-
3872 ungrabMouseForPopup(popup);-
3873-
3874 // transfer grab back to keyboard grabber if any, otherwise release the grab-
3875 ungrabKeyboardForPopup(popup);-
3876 }
never executed: end of block
0
3877-
3878 if (active_window) {
active_windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
3879 if (QWidget *fw = active_window->focusWidget()) {
QWidget *fw = ...>focusWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
3880 if (fw != QApplication::focusWidget()) {
fw != QApplica...:focusWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
3881 fw->setFocus(Qt::PopupFocusReason);-
3882 } else {
never executed: end of block
0
3883 QFocusEvent e(QEvent::FocusIn, Qt::PopupFocusReason);-
3884 QCoreApplication::sendEvent(fw, &e);-
3885 }
never executed: end of block
0
3886 }-
3887 }
never executed: end of block
0
3888-
3889 } else {
never executed: end of block
0
3890 // A popup was closed, so the previous popup gets the focus.-
3891 QWidget* aw = QApplicationPrivate::popupWidgets->constLast();-
3892 if (QWidget *fw = aw->focusWidget())
QWidget *fw = ...>focusWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
3893 fw->setFocus(Qt::PopupFocusReason);
never executed: fw->setFocus(Qt::PopupFocusReason);
0
3894-
3895 if (QApplicationPrivate::popupWidgets->count() == 1) // grab mouse/keyboard
QApplicationPr...->count() == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
3896 grabForPopup(aw);
never executed: grabForPopup(aw);
0
3897 }
never executed: end of block
0
3898-
3899}-
3900-
3901int openPopupCount = 0;-
3902-
3903void QApplicationPrivate::openPopup(QWidget *popup)-
3904{-
3905 openPopupCount++;-
3906 if (!popupWidgets) // create list
!popupWidgetsDescription
TRUEnever evaluated
FALSEnever evaluated
0
3907 popupWidgets = new QWidgetList;
never executed: popupWidgets = new QWidgetList;
0
3908 popupWidgets->append(popup); // add to end of list-
3909-
3910 if (QApplicationPrivate::popupWidgets->count() == 1) // grab mouse/keyboard
QApplicationPr...->count() == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
3911 grabForPopup(popup);
never executed: grabForPopup(popup);
0
3912-
3913 // popups are not focus-handled by the window system (the first-
3914 // popup grabbed the keyboard), so we have to do that manually: A-
3915 // new popup gets the focus-
3916 if (popup->focusWidget()) {
popup->focusWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
3917 popup->focusWidget()->setFocus(Qt::PopupFocusReason);-
3918 } else if (popupWidgets->count() == 1) { // this was the first popup
never executed: end of block
popupWidgets->count() == 1Description
TRUEnever evaluated
FALSEnever evaluated
0
3919 if (QWidget *fw = QApplication::focusWidget()) {
QWidget *fw = ...:focusWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
3920 QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason);-
3921 QApplication::sendEvent(fw, &e);-
3922 }
never executed: end of block
0
3923 }
never executed: end of block
0
3924}
never executed: end of block
0
3925-
3926#ifdef QT_KEYPAD_NAVIGATION-
3927/*!-
3928 Sets the kind of focus navigation Qt should use to \a mode.-
3929-
3930 This feature is available in Qt for Embedded Linux only.-
3931-
3932 \since 4.6-
3933-
3934 \sa keypadNavigationEnabled()-
3935*/-
3936void QApplication::setNavigationMode(Qt::NavigationMode mode)-
3937{-
3938 QApplicationPrivate::navigationMode = mode;-
3939}-
3940-
3941/*!-
3942 Returns what kind of focus navigation Qt is using.-
3943-
3944 This feature is available in Qt for Embedded Linux only.-
3945-
3946 \since 4.6-
3947-
3948 \sa keypadNavigationEnabled()-
3949*/-
3950Qt::NavigationMode QApplication::navigationMode()-
3951{-
3952 return QApplicationPrivate::navigationMode;-
3953}-
3954-
3955/*!-
3956 Sets whether Qt should use focus navigation suitable for use with a-
3957 minimal keypad.-
3958-
3959 This feature is available in Qt for Embedded Linux, and Windows CE only.-
3960-
3961 \note On Windows CE this feature is disabled by default for touch device-
3962 mkspecs. To enable keypad navigation, build Qt with-
3963 QT_KEYPAD_NAVIGATION defined.-
3964-
3965 \deprecated-
3966-
3967 \sa setNavigationMode()-
3968*/-
3969void QApplication::setKeypadNavigationEnabled(bool enable)-
3970{-
3971 if (enable) {-
3972 QApplication::setNavigationMode(Qt::NavigationModeKeypadTabOrder);-
3973 } else {-
3974 QApplication::setNavigationMode(Qt::NavigationModeNone);-
3975 }-
3976}-
3977-
3978/*!-
3979 Returns \c true if Qt is set to use keypad navigation; otherwise returns-
3980 false. The default value is false.-
3981-
3982 This feature is available in Qt for Embedded Linux, and Windows CE only.-
3983-
3984 \note On Windows CE this feature is disabled by default for touch device-
3985 mkspecs. To enable keypad navigation, build Qt with-
3986 QT_KEYPAD_NAVIGATION defined.-
3987-
3988 \deprecated-
3989-
3990 \sa navigationMode()-
3991*/-
3992bool QApplication::keypadNavigationEnabled()-
3993{-
3994 return QApplicationPrivate::navigationMode == Qt::NavigationModeKeypadTabOrder ||-
3995 QApplicationPrivate::navigationMode == Qt::NavigationModeKeypadDirectional;-
3996}-
3997#endif-
3998-
3999/*!-
4000 \fn void QApplication::alert(QWidget *widget, int msec)-
4001 \since 4.3-
4002-
4003 Causes an alert to be shown for \a widget if the window is not the active-
4004 window. The alert is shown for \a msec miliseconds. If \a msec is zero (the-
4005 default), then the alert is shown indefinitely until the window becomes-
4006 active again.-
4007-
4008 Currently this function does nothing on Qt for Embedded Linux.-
4009-
4010 On \macos, this works more at the application level and will cause the-
4011 application icon to bounce in the dock.-
4012-
4013 On Windows, this causes the window's taskbar entry to flash for a time. If-
4014 \a msec is zero, the flashing will stop and the taskbar entry will turn a-
4015 different color (currently orange).-
4016-
4017 On X11, this will cause the window to be marked as "demands attention", the-
4018 window must not be hidden (i.e. not have hide() called on it, but be-
4019 visible in some sort of way) in order for this to work.-
4020*/-
4021void QApplication::alert(QWidget *widget, int duration)-
4022{-
4023 if (widget) {
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
4024 if (widget->window()->isActiveWindow() && !(widget->window()->windowState() & Qt::WindowMinimized))
widget->window...ActiveWindow()Description
TRUEnever evaluated
FALSEnever evaluated
!(widget->wind...ndowMinimized)Description
TRUEnever evaluated
FALSEnever evaluated
0
4025 return;
never executed: return;
0
4026 if (QWindow *window= QApplicationPrivate::windowForWidget(widget))
QWindow *windo...Widget(widget)Description
TRUEnever evaluated
FALSEnever evaluated
0
4027 window->alert(duration);
never executed: window->alert(duration);
0
4028 } else {
never executed: end of block
0
4029 const auto topLevels = topLevelWidgets();-
4030 for (QWidget *topLevel : topLevels)-
4031 QApplication::alert(topLevel, duration);
never executed: QApplication::alert(topLevel, duration);
0
4032 }
never executed: end of block
0
4033}-
4034-
4035/*!-
4036 \property QApplication::cursorFlashTime-
4037 \brief the text cursor's flash (blink) time in milliseconds-
4038-
4039 The flash time is the time required to display, invert and restore the-
4040 caret display. Usually the text cursor is displayed for half the cursor-
4041 flash time, then hidden for the same amount of time, but this may vary.-
4042-
4043 The default value on X11 is 1000 milliseconds. On Windows, the-
4044 \uicontrol{Control Panel} value is used and setting this property sets the cursor-
4045 flash time for all applications.-
4046-
4047 We recommend that widgets do not cache this value as it may change at any-
4048 time if the user changes the global desktop settings.-
4049-
4050 \note This property may hold a negative value, for instance if cursor-
4051 blinking is disabled.-
4052*/-
4053void QApplication::setCursorFlashTime(int msecs)-
4054{-
4055 QGuiApplication::styleHints()->setCursorFlashTime(msecs);-
4056}
never executed: end of block
0
4057-
4058int QApplication::cursorFlashTime()-
4059{-
4060 return QGuiApplication::styleHints()->cursorFlashTime();
never executed: return QGuiApplication::styleHints()->cursorFlashTime();
0
4061}-
4062-
4063/*!-
4064 \property QApplication::doubleClickInterval-
4065 \brief the time limit in milliseconds that distinguishes a double click-
4066 from two consecutive mouse clicks-
4067-
4068 The default value on X11 is 400 milliseconds. On Windows and Mac OS, the-
4069 operating system's value is used.-
4070*/-
4071void QApplication::setDoubleClickInterval(int ms)-
4072{-
4073 QGuiApplication::styleHints()->setMouseDoubleClickInterval(ms);-
4074}
never executed: end of block
0
4075-
4076int QApplication::doubleClickInterval()-
4077{-
4078 return QGuiApplication::styleHints()->mouseDoubleClickInterval();
never executed: return QGuiApplication::styleHints()->mouseDoubleClickInterval();
0
4079}-
4080-
4081/*!-
4082 \fn QApplication::keyboardInputDirection()-
4083 \since 4.2-
4084 \deprecated-
4085-
4086 Returns the current keyboard input direction. Replaced with QInputMethod::inputDirection()-
4087 \sa QInputMethod::inputDirection()-
4088*/-
4089-
4090/*!-
4091 \property QApplication::keyboardInputInterval-
4092 \brief the time limit in milliseconds that distinguishes a key press-
4093 from two consecutive key presses-
4094 \since 4.2-
4095-
4096 The default value on X11 is 400 milliseconds. On Windows and Mac OS, the-
4097 operating system's value is used.-
4098*/-
4099void QApplication::setKeyboardInputInterval(int ms)-
4100{-
4101 QGuiApplication::styleHints()->setKeyboardInputInterval(ms);-
4102}
never executed: end of block
0
4103-
4104int QApplication::keyboardInputInterval()-
4105{-
4106 return QGuiApplication::styleHints()->keyboardInputInterval();
never executed: return QGuiApplication::styleHints()->keyboardInputInterval();
0
4107}-
4108-
4109/*!-
4110 \property QApplication::wheelScrollLines-
4111 \brief the number of lines to scroll a widget, when the-
4112 mouse wheel is rotated.-
4113-
4114 If the value exceeds the widget's number of visible lines, the widget-
4115 should interpret the scroll operation as a single \e{page up} or-
4116 \e{page down}. If the widget is an \l{QAbstractItemView}{item view class},-
4117 then the result of scrolling one \e line depends on the setting of the-
4118 widget's \l{QAbstractItemView::verticalScrollMode()}{scroll mode}. Scroll-
4119 one \e line can mean \l{QAbstractItemView::ScrollPerItem}{scroll one item}-
4120 or \l{QAbstractItemView::ScrollPerPixel}{scroll one pixel}.-
4121-
4122 By default, this property has a value of 3.-
4123*/-
4124#ifndef QT_NO_WHEELEVENT-
4125int QApplication::wheelScrollLines()-
4126{-
4127 return QApplicationPrivate::wheel_scroll_lines;
never executed: return QApplicationPrivate::wheel_scroll_lines;
0
4128}-
4129-
4130void QApplication::setWheelScrollLines(int lines)-
4131{-
4132 QApplicationPrivate::wheel_scroll_lines = lines;-
4133}
never executed: end of block
0
4134#endif-
4135-
4136static inline int uiEffectToFlag(Qt::UIEffect effect)-
4137{-
4138 switch (effect) {-
4139 case Qt::UI_General:
never executed: case Qt::UI_General:
0
4140 return QPlatformTheme::GeneralUiEffect;
never executed: return QPlatformTheme::GeneralUiEffect;
0
4141 case Qt::UI_AnimateMenu:
never executed: case Qt::UI_AnimateMenu:
0
4142 return QPlatformTheme::AnimateMenuUiEffect;
never executed: return QPlatformTheme::AnimateMenuUiEffect;
0
4143 case Qt::UI_FadeMenu:
never executed: case Qt::UI_FadeMenu:
0
4144 return QPlatformTheme::FadeMenuUiEffect;
never executed: return QPlatformTheme::FadeMenuUiEffect;
0
4145 case Qt::UI_AnimateCombo:
never executed: case Qt::UI_AnimateCombo:
0
4146 return QPlatformTheme::AnimateComboUiEffect;
never executed: return QPlatformTheme::AnimateComboUiEffect;
0
4147 case Qt::UI_AnimateTooltip:
never executed: case Qt::UI_AnimateTooltip:
0
4148 return QPlatformTheme::AnimateTooltipUiEffect;
never executed: return QPlatformTheme::AnimateTooltipUiEffect;
0
4149 case Qt::UI_FadeTooltip:
never executed: case Qt::UI_FadeTooltip:
0
4150 return QPlatformTheme::FadeTooltipUiEffect;
never executed: return QPlatformTheme::FadeTooltipUiEffect;
0
4151 case Qt::UI_AnimateToolBox:
never executed: case Qt::UI_AnimateToolBox:
0
4152 return QPlatformTheme::AnimateToolBoxUiEffect;
never executed: return QPlatformTheme::AnimateToolBoxUiEffect;
0
4153 }-
4154 return 0;
never executed: return 0;
0
4155}-
4156-
4157/*!-
4158 \fn void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable)-
4159-
4160 Enables the UI effect \a effect if \a enable is true, otherwise the effect-
4161 will not be used.-
4162-
4163 \note All effects are disabled on screens running at less than 16-bit color-
4164 depth.-
4165-
4166 \sa isEffectEnabled(), Qt::UIEffect, setDesktopSettingsAware()-
4167*/-
4168void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable)-
4169{-
4170 int effectFlags = uiEffectToFlag(effect);-
4171 if (enable) {
enableDescription
TRUEnever evaluated
FALSEnever evaluated
0
4172 if (effectFlags & QPlatformTheme::FadeMenuUiEffect)
effectFlags & ...deMenuUiEffectDescription
TRUEnever evaluated
FALSEnever evaluated
0
4173 effectFlags |= QPlatformTheme::AnimateMenuUiEffect;
never executed: effectFlags |= QPlatformTheme::AnimateMenuUiEffect;
0
4174 if (effectFlags & QPlatformTheme::FadeTooltipUiEffect)
effectFlags & ...ooltipUiEffectDescription
TRUEnever evaluated
FALSEnever evaluated
0
4175 effectFlags |= QPlatformTheme::AnimateTooltipUiEffect;
never executed: effectFlags |= QPlatformTheme::AnimateTooltipUiEffect;
0
4176 QApplicationPrivate::enabledAnimations |= effectFlags;-
4177 } else {
never executed: end of block
0
4178 QApplicationPrivate::enabledAnimations &= ~effectFlags;-
4179 }
never executed: end of block
0
4180}-
4181-
4182/*!-
4183 \fn bool QApplication::isEffectEnabled(Qt::UIEffect effect)-
4184-
4185 Returns \c true if \a effect is enabled; otherwise returns \c false.-
4186-
4187 By default, Qt will try to use the desktop settings. To prevent this, call-
4188 setDesktopSettingsAware(false).-
4189-
4190 \note All effects are disabled on screens running at less than 16-bit color-
4191 depth.-
4192-
4193 \sa setEffectEnabled(), Qt::UIEffect-
4194*/-
4195bool QApplication::isEffectEnabled(Qt::UIEffect effect)-
4196{-
4197 CHECK_QAPP_INSTANCE(false)
never executed: end of block
never executed: return false;
__builtin_expe...ance()), true)Description
TRUEnever evaluated
FALSEnever evaluated
0
4198 return QColormap::instance().depth() >= 16
never executed: return QColormap::instance().depth() >= 16 && (QApplicationPrivate::enabledAnimations & QPlatformTheme::GeneralUiEffect) && (QApplicationPrivate::enabledAnimations & uiEffectToFlag(effect));
0
4199 && (QApplicationPrivate::enabledAnimations & QPlatformTheme::GeneralUiEffect)
never executed: return QColormap::instance().depth() >= 16 && (QApplicationPrivate::enabledAnimations & QPlatformTheme::GeneralUiEffect) && (QApplicationPrivate::enabledAnimations & uiEffectToFlag(effect));
0
4200 && (QApplicationPrivate::enabledAnimations & uiEffectToFlag(effect));
never executed: return QColormap::instance().depth() >= 16 && (QApplicationPrivate::enabledAnimations & QPlatformTheme::GeneralUiEffect) && (QApplicationPrivate::enabledAnimations & uiEffectToFlag(effect));
0
4201}-
4202-
4203/*!-
4204 \fn void QApplication::beep()-
4205-
4206 Sounds the bell, using the default volume and sound. The function is \e not-
4207 available in Qt for Embedded Linux.-
4208*/-
4209void QApplication::beep()-
4210{-
4211 QGuiApplicationPrivate::platformIntegration()->beep();-
4212}
never executed: end of block
0
4213-
4214/*!-
4215 \macro qApp-
4216 \relates QApplication-
4217-
4218 A global pointer referring to the unique application object. It is-
4219 equivalent to QCoreApplication::instance(), but cast as a QApplication pointer,-
4220 so only valid when the unique application object is a QApplication.-
4221-
4222 \sa QCoreApplication::instance(), qGuiApp-
4223*/-
4224-
4225/*!-
4226 \fn QLocale QApplication::keyboardInputLocale()-
4227 \since 4.2-
4228 \obsolete-
4229-
4230 Returns the current keyboard input locale. Replaced with QInputMethod::locale()-
4231*/-
4232-
4233bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event)-
4234{-
4235 return QGuiApplication::sendSpontaneousEvent(receiver, event);
never executed: return QGuiApplication::sendSpontaneousEvent(receiver, event);
0
4236}-
4237-
4238void QApplicationPrivate::giveFocusAccordingToFocusPolicy(QWidget *widget, QEvent *event, QPoint localPos)-
4239{-
4240 const bool setFocusOnRelease = QGuiApplication::styleHints()->setFocusOnTouchRelease();-
4241 Qt::FocusPolicy focusPolicy = Qt::ClickFocus;-
4242 static QPointer<QWidget> focusedWidgetOnTouchBegin = 0;-
4243-
4244 switch (event->type()) {-
4245 case QEvent::MouseButtonPress:
never executed: case QEvent::MouseButtonPress:
0
4246 case QEvent::MouseButtonDblClick:
never executed: case QEvent::MouseButtonDblClick:
0
4247 case QEvent::TouchBegin:
never executed: case QEvent::TouchBegin:
0
4248 focusedWidgetOnTouchBegin = QApplication::focusWidget();-
4249 if (setFocusOnRelease)
setFocusOnReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
0
4250 return;
never executed: return;
0
4251 break;
never executed: break;
0
4252 case QEvent::MouseButtonRelease:
never executed: case QEvent::MouseButtonRelease:
0
4253 case QEvent::TouchEnd:
never executed: case QEvent::TouchEnd:
0
4254 if (!setFocusOnRelease)
!setFocusOnReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
0
4255 return;
never executed: return;
0
4256 if (focusedWidgetOnTouchBegin != QApplication::focusWidget()) {
focusedWidgetO...:focusWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
4257 // Focus widget was changed while delivering press/move events.-
4258 // To not interfere with application logic, we leave focus as-is-
4259 return;
never executed: return;
0
4260 }-
4261 break;
never executed: break;
0
4262 case QEvent::Wheel:
never executed: case QEvent::Wheel:
0
4263 focusPolicy = Qt::WheelFocus;-
4264 break;
never executed: break;
0
4265 default:
never executed: default:
0
4266 return;
never executed: return;
0
4267 }-
4268-
4269 QWidget *focusWidget = widget;-
4270 while (focusWidget) {
focusWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
4271 if (focusWidget->isEnabled()
focusWidget->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
0
4272 && focusWidget->rect().contains(localPos)
focusWidget->r...ains(localPos)Description
TRUEnever evaluated
FALSEnever evaluated
0
4273 && QApplicationPrivate::shouldSetFocus(focusWidget, focusPolicy)) {
QApplicationPr..., focusPolicy)Description
TRUEnever evaluated
FALSEnever evaluated
0
4274 focusWidget->setFocus(Qt::MouseFocusReason);-
4275 break;
never executed: break;
0
4276 }-
4277 if (focusWidget->isWindow())
focusWidget->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
4278 break;
never executed: break;
0
4279-
4280 // find out whether this widget (or its proxy) already has focus-
4281 QWidget *f = focusWidget;-
4282 if (focusWidget->d_func()->extra && focusWidget->d_func()->extra->focus_proxy)
focusWidget->d_func()->extraDescription
TRUEnever evaluated
FALSEnever evaluated
focusWidget->d...a->focus_proxyDescription
TRUEnever evaluated
FALSEnever evaluated
0
4283 f = focusWidget->d_func()->extra->focus_proxy;
never executed: f = focusWidget->d_func()->extra->focus_proxy;
0
4284 // if it has, stop here.-
4285 // otherwise a click on the focused widget would remove its focus if ClickFocus isn't set-
4286 if (f->hasFocus())
f->hasFocus()Description
TRUEnever evaluated
FALSEnever evaluated
0
4287 break;
never executed: break;
0
4288-
4289 localPos += focusWidget->pos();-
4290 focusWidget = focusWidget->parentWidget();-
4291 }
never executed: end of block
0
4292}
never executed: end of block
0
4293-
4294bool QApplicationPrivate::shouldSetFocus(QWidget *w, Qt::FocusPolicy policy)-
4295{-
4296 QWidget *f = w;-
4297 while (f->d_func()->extra && f->d_func()->extra->focus_proxy)
f->d_func()->extraDescription
TRUEnever evaluated
FALSEnever evaluated
f->d_func()->e...a->focus_proxyDescription
TRUEnever evaluated
FALSEnever evaluated
0
4298 f = f->d_func()->extra->focus_proxy;
never executed: f = f->d_func()->extra->focus_proxy;
0
4299-
4300 if ((w->focusPolicy() & policy) != policy)
(w->focusPolic...icy) != policyDescription
TRUEnever evaluated
FALSEnever evaluated
0
4301 return false;
never executed: return false;
0
4302 if (w != f && (f->focusPolicy() & policy) != policy)
w != fDescription
TRUEnever evaluated
FALSEnever evaluated
(f->focusPolic...icy) != policyDescription
TRUEnever evaluated
FALSEnever evaluated
0
4303 return false;
never executed: return false;
0
4304 return true;
never executed: return true;
0
4305}-
4306-
4307bool QApplicationPrivate::updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent)-
4308{-
4309 bool containsPress = false;-
4310 for (int i = 0; i < touchEvent->touchPoints().count(); ++i) {
i < touchEvent...ints().count()Description
TRUEnever evaluated
FALSEnever evaluated
0
4311 QTouchEvent::TouchPoint &touchPoint = touchEvent->_touchPoints[i];-
4312-
4313 // preserve the sub-pixel resolution-
4314 QRectF rect = touchPoint.screenRect();-
4315 const QPointF screenPos = rect.center();-
4316 const QPointF delta = screenPos - screenPos.toPoint();-
4317-
4318 rect.moveCenter(widget->mapFromGlobal(screenPos.toPoint()) + delta);-
4319 touchPoint.d->rect = rect;-
4320 touchPoint.d->startPos = widget->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta;-
4321 touchPoint.d->lastPos = widget->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta;-
4322-
4323 if (touchPoint.state() == Qt::TouchPointPressed)
touchPoint.sta...chPointPressedDescription
TRUEnever evaluated
FALSEnever evaluated
0
4324 containsPress = true;
never executed: containsPress = true;
0
4325 }
never executed: end of block
0
4326 return containsPress;
never executed: return containsPress;
0
4327}-
4328-
4329void QApplicationPrivate::initializeMultitouch()-
4330{-
4331 initializeMultitouch_sys();-
4332}
never executed: end of block
0
4333-
4334void QApplicationPrivate::initializeMultitouch_sys()-
4335{-
4336}-
4337-
4338void QApplicationPrivate::cleanupMultitouch()-
4339{-
4340 cleanupMultitouch_sys();-
4341}
never executed: end of block
0
4342-
4343void QApplicationPrivate::cleanupMultitouch_sys()-
4344{-
4345}-
4346-
4347QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device, const QTouchEvent::TouchPoint &touchPoint)-
4348{-
4349 const QPointF screenPos = touchPoint.screenPos();-
4350 int closestTouchPointId = -1;-
4351 QObject *closestTarget = 0;-
4352 qreal closestDistance = qreal(0.);-
4353 QHash<ActiveTouchPointsKey, ActiveTouchPointsValue>::const_iterator it = activeTouchPoints.constBegin(),-
4354 ite = activeTouchPoints.constEnd();-
4355 while (it != ite) {
it != iteDescription
TRUEnever evaluated
FALSEnever evaluated
0
4356 if (it.key().device == device && it.key().touchPointId != touchPoint.id()) {
it.key().device == deviceDescription
TRUEnever evaluated
FALSEnever evaluated
it.key().touch...ouchPoint.id()Description
TRUEnever evaluated
FALSEnever evaluated
0
4357 const QTouchEvent::TouchPoint &touchPoint = it->touchPoint;-
4358 qreal dx = screenPos.x() - touchPoint.screenPos().x();-
4359 qreal dy = screenPos.y() - touchPoint.screenPos().y();-
4360 qreal distance = dx * dx + dy * dy;-
4361 if (closestTouchPointId == -1 || distance < closestDistance) {
closestTouchPointId == -1Description
TRUEnever evaluated
FALSEnever evaluated
distance < closestDistanceDescription
TRUEnever evaluated
FALSEnever evaluated
0
4362 closestTouchPointId = touchPoint.id();-
4363 closestDistance = distance;-
4364 closestTarget = it.value().target.data();-
4365 }
never executed: end of block
0
4366 }
never executed: end of block
0
4367 ++it;-
4368 }
never executed: end of block
0
4369 return static_cast<QWidget *>(closestTarget);
never executed: return static_cast<QWidget *>(closestTarget);
0
4370}-
4371-
4372void QApplicationPrivate::activateImplicitTouchGrab(QWidget *widget, QTouchEvent *touchEvent)-
4373{-
4374 if (touchEvent->type() != QEvent::TouchBegin)
touchEvent->ty...nt::TouchBeginDescription
TRUEnever evaluated
FALSEnever evaluated
0
4375 return;
never executed: return;
0
4376-
4377 for (int i = 0, tc = touchEvent->touchPoints().count(); i < tc; ++i) {
i < tcDescription
TRUEnever evaluated
FALSEnever evaluated
0
4378 const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().at(i);-
4379 activeTouchPoints[QGuiApplicationPrivate::ActiveTouchPointsKey(touchEvent->device(), touchPoint.id())].target = widget;-
4380 }
never executed: end of block
0
4381}
never executed: end of block
0
4382-
4383bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,-
4384 QTouchDevice *device,-
4385 const QList<QTouchEvent::TouchPoint> &touchPoints,-
4386 ulong timestamp)-
4387{-
4388 QApplicationPrivate *d = self;-
4389 typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints;-
4390 QHash<QWidget *, StatesAndTouchPoints> widgetsNeedingEvents;-
4391-
4392 for (int i = 0; i < touchPoints.count(); ++i) {
i < touchPoints.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
4393 QTouchEvent::TouchPoint touchPoint = touchPoints.at(i);-
4394 // explicitly detach from the original touch point that we got, so even-
4395 // if the touchpoint structs are reused, we will make a copy that we'll-
4396 // deliver to the user (which might want to store the struct for later use).-
4397 touchPoint.d = touchPoint.d->detach();-
4398-
4399 // update state-
4400 QPointer<QObject> target;-
4401 ActiveTouchPointsKey touchInfoKey(device, touchPoint.id());-
4402 ActiveTouchPointsValue &touchInfo = d->activeTouchPoints[touchInfoKey];-
4403 if (touchPoint.state() == Qt::TouchPointPressed) {
touchPoint.sta...chPointPressedDescription
TRUEnever evaluated
FALSEnever evaluated
0
4404 if (device->type() == QTouchDevice::TouchPad) {
device->type()...vice::TouchPadDescription
TRUEnever evaluated
FALSEnever evaluated
0
4405 // on touch-pads, send all touch points to the same widget-
4406 target = d->activeTouchPoints.isEmpty()
d->activeTouchPoints.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
4407 ? QPointer<QObject>()-
4408 : d->activeTouchPoints.constBegin().value().target;-
4409 }
never executed: end of block
0
4410-
4411 if (!target) {
!targetDescription
TRUEnever evaluated
FALSEnever evaluated
0
4412 // determine which widget this event will go to-
4413 if (!window)
!windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
4414 window = QApplication::topLevelAt(touchPoint.screenPos().toPoint());
never executed: window = QApplication::topLevelAt(touchPoint.screenPos().toPoint());
0
4415 if (!window)
!windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
4416 continue;
never executed: continue;
0
4417 target = window->childAt(window->mapFromGlobal(touchPoint.screenPos().toPoint()));-
4418 if (!target)
!targetDescription
TRUEnever evaluated
FALSEnever evaluated
0
4419 target = window;
never executed: target = window;
0
4420 }
never executed: end of block
0
4421-
4422 if (device->type() == QTouchDevice::TouchScreen) {
device->type()...e::TouchScreenDescription
TRUEnever evaluated
FALSEnever evaluated
0
4423 QWidget *closestWidget = d->findClosestTouchPointTarget(device, touchPoint);-
4424 QWidget *widget = static_cast<QWidget *>(target.data());-
4425 if (closestWidget
closestWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
4426 && (widget->isAncestorOf(closestWidget) || closestWidget->isAncestorOf(widget))) {
widget->isAnce...closestWidget)Description
TRUEnever evaluated
FALSEnever evaluated
closestWidget-...storOf(widget)Description
TRUEnever evaluated
FALSEnever evaluated
0
4427 target = closestWidget;-
4428 }
never executed: end of block
0
4429 }
never executed: end of block
0
4430-
4431 touchInfo.target = target;-
4432 } else {
never executed: end of block
0
4433 target = touchInfo.target;-
4434 if (!target)
!targetDescription
TRUEnever evaluated
FALSEnever evaluated
0
4435 continue;
never executed: continue;
0
4436 }
never executed: end of block
0
4437 Q_ASSERT(target.data() != 0);-
4438-
4439 QWidget *targetWidget = static_cast<QWidget *>(target.data());-
4440-
4441#ifdef Q_OS_OSX-
4442 // Single-touch events are normally not sent unless WA_TouchPadAcceptSingleTouchEvents is set.-
4443 // In Qt 4 this check was in OS X-only code. That behavior is preserved here by the #ifdef.-
4444 if (touchPoints.count() == 1-
4445 && device->type() == QTouchDevice::TouchPad-
4446 && !targetWidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents))-
4447 continue;-
4448#endif-
4449-
4450 StatesAndTouchPoints &maskAndPoints = widgetsNeedingEvents[targetWidget];-
4451 maskAndPoints.first |= touchPoint.state();-
4452 maskAndPoints.second.append(touchPoint);-
4453 }
never executed: end of block
0
4454-
4455 if (widgetsNeedingEvents.isEmpty())
widgetsNeedingEvents.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
4456 return false;
never executed: return false;
0
4457-
4458 bool accepted = false;-
4459 QHash<QWidget *, StatesAndTouchPoints>::ConstIterator it = widgetsNeedingEvents.constBegin();-
4460 const QHash<QWidget *, StatesAndTouchPoints>::ConstIterator end = widgetsNeedingEvents.constEnd();-
4461 for (; it != end; ++it) {
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
4462 const QPointer<QWidget> widget = it.key();-
4463 if (!QApplicationPrivate::tryModalHelper(widget, 0))
!QApplicationP...per(widget, 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
4464 continue;
never executed: continue;
0
4465-
4466 QEvent::Type eventType;-
4467 switch (it.value().first) {-
4468 case Qt::TouchPointPressed:
never executed: case Qt::TouchPointPressed:
0
4469 eventType = QEvent::TouchBegin;-
4470 break;
never executed: break;
0
4471 case Qt::TouchPointReleased:
never executed: case Qt::TouchPointReleased:
0
4472 eventType = QEvent::TouchEnd;-
4473 break;
never executed: break;
0
4474 case Qt::TouchPointStationary:
never executed: case Qt::TouchPointStationary:
0
4475 // don't send the event if nothing changed-
4476 continue;
never executed: continue;
0
4477 default:
never executed: default:
0
4478 eventType = QEvent::TouchUpdate;-
4479 break;
never executed: break;
0
4480 }-
4481-
4482 QTouchEvent touchEvent(eventType,-
4483 device,-
4484 QApplication::keyboardModifiers(),-
4485 it.value().first,-
4486 it.value().second);-
4487 bool containsPress = updateTouchPointsForWidget(widget, &touchEvent);-
4488 touchEvent.setTimestamp(timestamp);-
4489 touchEvent.setWindow(window->windowHandle());-
4490 touchEvent.setTarget(widget);-
4491-
4492 if (containsPress)
containsPressDescription
TRUEnever evaluated
FALSEnever evaluated
0
4493 widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent);
never executed: widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent);
0
4494-
4495 switch (touchEvent.type()) {-
4496 case QEvent::TouchBegin:
never executed: case QEvent::TouchBegin:
0
4497 {-
4498 // if the TouchBegin handler recurses, we assume that means the event-
4499 // has been implicitly accepted and continue to send touch events-
4500 if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted()) {
QApplication::..., &touchEvent)Description
TRUEnever evaluated
FALSEnever evaluated
touchEvent.isAccepted()Description
TRUEnever evaluated
FALSEnever evaluated
0
4501 accepted = true;-
4502 if (!widget.isNull())
!widget.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
4503 widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent);
never executed: widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent);
0
4504 }
never executed: end of block
0
4505 break;
never executed: break;
0
4506 }-
4507 default:
never executed: default:
0
4508 if (widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent)
widget->testAt...uchBeginEvent)Description
TRUEnever evaluated
FALSEnever evaluated
0
4509#ifndef QT_NO_GESTURES-
4510 || QGestureManager::gesturePending(widget)
QGestureManage...ending(widget)Description
TRUEnever evaluated
FALSEnever evaluated
0
4511#endif-
4512 ) {-
4513 if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted())
QApplication::..., &touchEvent)Description
TRUEnever evaluated
FALSEnever evaluated
touchEvent.isAccepted()Description
TRUEnever evaluated
FALSEnever evaluated
0
4514 accepted = true;
never executed: accepted = true;
0
4515 // widget can be deleted on TouchEnd-
4516 if (touchEvent.type() == QEvent::TouchEnd && !widget.isNull())
touchEvent.typ...vent::TouchEndDescription
TRUEnever evaluated
FALSEnever evaluated
!widget.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
4517 widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, false);
never executed: widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, false);
0
4518 }
never executed: end of block
0
4519 break;
never executed: break;
0
4520 }-
4521 }-
4522 return accepted;
never executed: return accepted;
0
4523}-
4524-
4525void QApplicationPrivate::translateTouchCancel(QTouchDevice *device, ulong timestamp)-
4526{-
4527 QTouchEvent touchEvent(QEvent::TouchCancel, device, QApplication::keyboardModifiers());-
4528 touchEvent.setTimestamp(timestamp);-
4529 QHash<ActiveTouchPointsKey, ActiveTouchPointsValue>::const_iterator it-
4530 = self->activeTouchPoints.constBegin(), ite = self->activeTouchPoints.constEnd();-
4531 QSet<QWidget *> widgetsNeedingCancel;-
4532 while (it != ite) {
it != iteDescription
TRUEnever evaluated
FALSEnever evaluated
0
4533 QWidget *widget = static_cast<QWidget *>(it->target.data());-
4534 if (widget)
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
4535 widgetsNeedingCancel.insert(widget);
never executed: widgetsNeedingCancel.insert(widget);
0
4536 ++it;-
4537 }
never executed: end of block
0
4538 for (QSet<QWidget *>::const_iterator widIt = widgetsNeedingCancel.constBegin(),-
4539 widItEnd = widgetsNeedingCancel.constEnd(); widIt != widItEnd; ++widIt) {
widIt != widItEndDescription
TRUEnever evaluated
FALSEnever evaluated
0
4540 QWidget *widget = *widIt;-
4541 touchEvent.setWindow(widget->windowHandle());-
4542 touchEvent.setTarget(widget);-
4543 QApplication::sendSpontaneousEvent(widget, &touchEvent);-
4544 }
never executed: end of block
0
4545}
never executed: end of block
0
4546-
4547void QApplicationPrivate::notifyThemeChanged()-
4548{-
4549 QGuiApplicationPrivate::notifyThemeChanged();-
4550 clearSystemPalette();-
4551 initSystemPalette();-
4552 qt_init_tooltip_palette();-
4553}
never executed: end of block
0
4554-
4555#ifndef QT_NO_DRAGANDDROP-
4556void QApplicationPrivate::notifyDragStarted(const QDrag *drag)-
4557{-
4558 // Prevent pickMouseReceiver() from using the widget where the drag was started after a drag operation.-
4559 QGuiApplicationPrivate::notifyDragStarted(drag);-
4560 qt_button_down = 0;-
4561}
never executed: end of block
0
4562#endif // QT_NO_DRAGANDDROP-
4563-
4564#ifndef QT_NO_GESTURES-
4565QGestureManager* QGestureManager::instance()-
4566{-
4567 QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();-
4568 if (!qAppPriv)
!qAppPrivDescription
TRUEnever evaluated
FALSEnever evaluated
0
4569 return 0;
never executed: return 0;
0
4570 if (!qAppPriv->gestureManager)
!qAppPriv->gestureManagerDescription
TRUEnever evaluated
FALSEnever evaluated
0
4571 qAppPriv->gestureManager = new QGestureManager(qApp);
never executed: qAppPriv->gestureManager = new QGestureManager((static_cast<QApplication *>(QCoreApplication::instance())));
0
4572 return qAppPriv->gestureManager;
never executed: return qAppPriv->gestureManager;
0
4573}-
4574#endif // QT_NO_GESTURES-
4575-
4576QPixmap QApplicationPrivate::applyQIconStyleHelper(QIcon::Mode mode, const QPixmap& base) const-
4577{-
4578 QStyleOption opt(0);-
4579 opt.palette = QGuiApplication::palette();-
4580 return QApplication::style()->generatedIconPixmap(mode, base, &opt);
never executed: return QApplication::style()->generatedIconPixmap(mode, base, &opt);
0
4581}-
4582-
4583QT_END_NAMESPACE-
4584-
4585#include "moc_qapplication.cpp"-
Source codeSwitch to Preprocessed file

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