Add platform plugin arguments to QLibraryInfo/qt.conf.
Make it possible to specify arguments to the platform plugins in a section of the qt.conf file: [Platforms] WindowsArguments=fontengine=freetype Change-Id: Ia05d0fa004471dcb74c78a88eec3b220ec3c6ad8 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>bb10
parent
da35793ee5
commit
0232fa3979
|
|
@ -40,6 +40,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "qdir.h"
|
||||
#include "qstringlist.h"
|
||||
#include "qfile.h"
|
||||
#include "qsettings.h"
|
||||
#include "qlibraryinfo.h"
|
||||
|
|
@ -113,6 +114,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
static const char platformsSection[] = "Platforms";
|
||||
|
||||
QLibrarySettings::QLibrarySettings()
|
||||
: settings(QLibraryInfoPrivate::findConfiguration())
|
||||
{
|
||||
|
|
@ -132,7 +135,8 @@ QLibrarySettings::QLibrarySettings()
|
|||
haveEffectivePaths = children.contains(QLatin1String("EffectivePaths"));
|
||||
#endif
|
||||
// Backwards compat: an existing but empty file is claimed to contain the Paths section.
|
||||
havePaths = !haveEffectivePaths || children.contains(QLatin1String("Paths"));
|
||||
havePaths = (!haveEffectivePaths && !children.contains(QLatin1String(platformsSection)))
|
||||
|| children.contains(QLatin1String("Paths"));
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
if (!havePaths)
|
||||
settings.reset(0);
|
||||
|
|
@ -461,6 +465,33 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns additional arguments to the platform plugin matching
|
||||
\a platformName which can be specified as a string list using
|
||||
the key \c Arguments in a group called \c Platforms of the
|
||||
\c qt.conf file.
|
||||
|
||||
sa {Using qt.conf}
|
||||
|
||||
\internal
|
||||
|
||||
\since 5.3
|
||||
*/
|
||||
|
||||
QStringList QLibraryInfo::platformPluginArguments(const QString &platformName)
|
||||
{
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
if (const QSettings *settings = QLibraryInfoPrivate::findConfiguration()) {
|
||||
QString key = QLatin1String(platformsSection);
|
||||
key += QLatin1Char('/');
|
||||
key += platformName;
|
||||
key += QLatin1String("Arguments");
|
||||
return settings->value(key).toStringList();
|
||||
}
|
||||
#endif // !QT_BOOTSTRAPPED
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
/*!
|
||||
\enum QLibraryInfo::LibraryLocation
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QStringList;
|
||||
|
||||
class Q_CORE_EXPORT QLibraryInfo
|
||||
{
|
||||
public:
|
||||
|
|
@ -96,6 +98,8 @@ public:
|
|||
static QString rawLocation(LibraryLocation, PathGroup);
|
||||
#endif
|
||||
|
||||
static QStringList platformPluginArguments(const QString &platformName);
|
||||
|
||||
private:
|
||||
QLibraryInfo();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@
|
|||
#include <QtCore/qmutex.h>
|
||||
#include <QtCore/private/qthread_p.h>
|
||||
#include <QtCore/qdir.h>
|
||||
#include <QtCore/qlibraryinfo.h>
|
||||
#include <QtDebug>
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
#include "qaccessible.h"
|
||||
|
|
@ -892,6 +893,9 @@ static void init_platform(const QString &pluginArgument, const QString &platform
|
|||
// Split into platform name and arguments
|
||||
QStringList arguments = pluginArgument.split(QLatin1Char(':'));
|
||||
const QString name = arguments.takeFirst().toLower();
|
||||
QString argumentsKey = name;
|
||||
argumentsKey[0] = argumentsKey.at(0).toUpper();
|
||||
arguments.append(QLibraryInfo::platformPluginArguments(argumentsKey));
|
||||
|
||||
// Create the platform integration.
|
||||
QGuiApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, arguments, argc, argv, platformPluginPath);
|
||||
|
|
|
|||
Loading…
Reference in New Issue