Make QCoreApplication::startingUp() return false when appropriate.

Currently, QCoreApplication::startingUp() returns true even after
a QCoreApplication has been constructed. This patch makes it return
false after it has been constructed and adds checks to QApplication
and QGuiApplication to ensure that it returns true within the
constructor of these classes.

Task-number: QTBUG-2591
Change-Id: Ie511522d35b5658c20be43dd112eae18c205277f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
This commit is contained in:
Mitch Curtis 2013-03-13 10:34:18 +01:00 committed by The Qt Project
parent 1d276c256f
commit fd7b52d268
3 changed files with 8 additions and 2 deletions

View File

@ -638,6 +638,8 @@ void QCoreApplication::init()
d->processCommandLineArguments();
qt_startup_hook();
QCoreApplicationPrivate::is_app_running = true; // No longer starting up.
}
/*!

View File

@ -926,6 +926,8 @@ static bool runningUnderDebugger()
void QGuiApplicationPrivate::init()
{
QCoreApplicationPrivate::is_app_running = false; // Starting up.
bool doGrabUnderDebugger = false;
QList<QByteArray> pluginList;
// Get command line params

View File

@ -588,6 +588,8 @@ extern void qRegisterWidgetsVariant();
*/
void QApplicationPrivate::initialize()
{
is_app_running = false; // Starting up.
QWidgetPrivate::mapper = new QWidgetMapper;
QWidgetPrivate::allWidgets = new QWidgetSet;
@ -601,8 +603,6 @@ void QApplicationPrivate::initialize()
qRegisterGuiStateMachine();
#endif
is_app_running = true; // no longer starting up
Q_Q(QApplication);
if (qgetenv("QT_USE_NATIVE_WINDOWS").toInt() > 0)
@ -629,6 +629,8 @@ void QApplicationPrivate::initialize()
if (QApplication::desktopSettingsAware())
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
QApplicationPrivate::enabledAnimations = theme->themeHint(QPlatformTheme::UiEffects).toInt();
is_app_running = true; // no longer starting up
}
/*****************************************************************************