diff options
Diffstat (limited to 'src/gui/kernel/qplatformintegrationfactory.cpp')
-rw-r--r-- | src/gui/kernel/qplatformintegrationfactory.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/gui/kernel/qplatformintegrationfactory.cpp b/src/gui/kernel/qplatformintegrationfactory.cpp index 21f53d17de..365edd2010 100644 --- a/src/gui/kernel/qplatformintegrationfactory.cpp +++ b/src/gui/kernel/qplatformintegrationfactory.cpp @@ -55,18 +55,30 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QPlatformIntegrationFactoryInterface_iid, QLatin1String("/platforms"), Qt::CaseInsensitive)) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, (QPlatformIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) -#endif -QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platform, const QStringList ¶mList, const QString &platformPluginPath) +static inline QPlatformIntegration *loadIntegration(QFactoryLoader *loader, const QString &key, const QStringList ¶meters, int &argc, char ** argv) +{ + const int index = loader->indexOf(key); + if (index != -1) { + if (QPlatformIntegrationPlugin *factory = qobject_cast<QPlatformIntegrationPlugin *>(loader->instance(index))) + if (QPlatformIntegration *result = factory->create(key, parameters, argc, argv)) + return result; + } + return 0; +} + +#endif // !QT_NO_LIBRARY + +QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platform, const QStringList ¶mList, int &argc, char **argv, const QString &platformPluginPath) { #ifndef QT_NO_LIBRARY // Try loading the plugin from platformPluginPath first: if (!platformPluginPath.isEmpty()) { QCoreApplication::addLibraryPath(platformPluginPath); - if (QPlatformIntegration *ret = qLoadPlugin1<QPlatformIntegration, QPlatformIntegrationPlugin>(directLoader(), platform, paramList)) + if (QPlatformIntegration *ret = loadIntegration(directLoader(), platform, paramList, argc, argv)) return ret; } - if (QPlatformIntegration *ret = qLoadPlugin1<QPlatformIntegration, QPlatformIntegrationPlugin>(loader(), platform, paramList)) + if (QPlatformIntegration *ret = loadIntegration(loader(), platform, paramList, argc, argv)) return ret; #endif return 0; |