OpenCoverage

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();