From 7ead3a39c71949e28d682f893f8b4037e25d7259 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 21 Jun 2013 08:54:47 +0200 Subject: Windows: Display a message box if platform plugin cannot be found. Task-number: QTBUG-31765 Task-number: QTBUG-31760 Change-Id: Iadfabccf7be755564e313a8f0c128f533b9bd024 Reviewed-by: Kai Koehne --- src/gui/kernel/qguiapplication.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 77c9978a9e..89664447c4 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -94,9 +94,12 @@ #include #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 +# include +#endif // Q_OS_WIN && !Q_OS_WINCE QT_BEGIN_NAMESPACE @@ -789,6 +792,12 @@ static void init_platform(const QString &pluginArgument, const QString &platform 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; } -- cgit v1.2.3