diff options
Diffstat (limited to 'src/gui/kernel/qplatformintegrationfactory.cpp')
-rw-r--r-- | src/gui/kernel/qplatformintegrationfactory.cpp | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/src/gui/kernel/qplatformintegrationfactory.cpp b/src/gui/kernel/qplatformintegrationfactory.cpp index 5a1fb3ca83..2c8a7ce0f8 100644 --- a/src/gui/kernel/qplatformintegrationfactory.cpp +++ b/src/gui/kernel/qplatformintegrationfactory.cpp @@ -42,23 +42,12 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_LIBRARY Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QPlatformIntegrationFactoryInterface_iid, QLatin1String("/platforms"), Qt::CaseInsensitive)) + +#ifndef QT_NO_LIBRARY Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, (QPlatformIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) - -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) @@ -67,19 +56,13 @@ QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platfor // Try loading the plugin from platformPluginPath first: if (!platformPluginPath.isEmpty()) { QCoreApplication::addLibraryPath(platformPluginPath); - if (QPlatformIntegration *ret = loadIntegration(directLoader(), platform, paramList, argc, argv)) + if (QPlatformIntegration *ret = qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin>(directLoader(), platform, paramList, argc, argv)) return ret; } - if (QPlatformIntegration *ret = loadIntegration(loader(), platform, paramList, argc, argv)) - return ret; #else - Q_UNUSED(platform); - Q_UNUSED(paramList); - Q_UNUSED(argc); - Q_UNUSED(argv); Q_UNUSED(platformPluginPath); #endif - return 0; + return qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin>(loader(), platform, paramList, argc, argv); } /*! |