Improve error output when platform plugin cannot be loaded

Forgetting to deploy the platform plugin, or deploying it to the wrong
folder, is a common mistake. The old error message didn't made it however
explicit what was happening. Make the log more verbose, and explicitly
state that the missing plugin is the reason for termination.

Change-Id: I810a0ef8da5f8e898e7e0c6f853972514a05c75d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Kai Koehne 2013-06-05 15:40:10 +02:00 committed by The Qt Project
parent 9ddcd900f6
commit 0d7d53fd46

View File

@ -782,12 +782,14 @@ 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.");
qFatal(qPrintable(fatalMessage));
return;
}