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 <kai.koehne@digia.com>
bb10
Friedemann Kleint 2013-06-21 08:54:47 +02:00 committed by The Qt Project
parent 851fae6dbe
commit 7ead3a39c7
1 changed files with 11 additions and 2 deletions

View File

@ -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
@ -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;
}