diff options
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 29a7e87d46..89664447c4 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -94,9 +94,12 @@ #include <QtGui/QClipboard> #endif -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) # include "private/qcore_mac_p.h" -#endif +#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +# include <QtCore/qt_windows.h> +# include <QtCore/QLibraryInfo> +#endif // Q_OS_WIN && !Q_OS_WINCE QT_BEGIN_NAMESPACE @@ -782,12 +785,20 @@ static void init_platform(const QString &pluginArgument, const QString &platform QGuiApplicationPrivate::platform_name = new QString(name); } else { QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath); - QString fatalMessage = - QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name); - foreach(const QString &key, keys) { - fatalMessage.append(key + QLatin1Char('\n')); - } - qFatal("%s", fatalMessage.toLocal8Bit().constData()); + + QString fatalMessage + = QStringLiteral("Failed to find or load platform plugin \"%1\".\n").arg(name); + if (!keys.isEmpty()) + fatalMessage += QStringLiteral("Available platforms are: %1\n").arg( + keys.join(QStringLiteral(", "))); + fatalMessage += QStringLiteral("GUI applications require a platform plugin. Terminating."); +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + // Windows: Display message box unless it is a console application + // or debug build showing an assert box. + if (!QLibraryInfo::isDebugBuild() && !GetConsoleWindow()) + MessageBox(0, (LPCTSTR)fatalMessage.utf16(), (LPCTSTR)(QCoreApplication::applicationName().utf16()), MB_OK | MB_ICONERROR); +#endif // Q_OS_WIN && !Q_OS_WINCE + qFatal("%s", qPrintable(fatalMessage)); return; } @@ -2477,10 +2488,18 @@ void QGuiApplicationPrivate::emitLastWindowClosed() bool QGuiApplicationPrivate::shouldQuit() { + const QWindowList processedWindows; + return shouldQuitInternal(processedWindows); +} + +bool QGuiApplicationPrivate::shouldQuitInternal(const QWindowList &processedWindows) +{ /* if there is no visible top-level window left, we allow the quit */ QWindowList list = QGuiApplication::topLevelWindows(); for (int i = 0; i < list.size(); ++i) { QWindow *w = list.at(i); + if (processedWindows.contains(w)) + continue; if (w->isVisible() && !w->transientParent()) return false; } |