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

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