summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qgenericpluginfactory_qpa.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-05-08 13:14:09 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-09 13:40:23 +0200
commit4e4403d69c60ea6429b3ad5e7898a84b1dc92be5 (patch)
tree4d8c3f222412438643fe54508036a452c6967152 /src/gui/kernel/qgenericpluginfactory_qpa.cpp
parentb316c3ac5e4acac75505bfd77677cecc181599af (diff)
No longer use deprecated methods for plugin loading.
Change-Id: I19c66b1c41ea4dd236726c86d7d071b210ec9244 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui/kernel/qgenericpluginfactory_qpa.cpp')
-rw-r--r--src/gui/kernel/qgenericpluginfactory_qpa.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.cpp b/src/gui/kernel/qgenericpluginfactory_qpa.cpp
index d4a7a9c20e..90da16f868 100644
--- a/src/gui/kernel/qgenericpluginfactory_qpa.cpp
+++ b/src/gui/kernel/qgenericpluginfactory_qpa.cpp
@@ -79,12 +79,12 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
*/
QObject *QGenericPluginFactory::create(const QString& key, const QString &specification)
{
- QString driver = key.toLower();
+ const QString driver = key.toLower();
#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
#ifndef QT_NO_LIBRARY
- if (QGenericPluginFactoryInterface *factory = qobject_cast<QGenericPluginFactoryInterface*>(loader()->instance(driver)))
- return factory->create(driver, specification);
+ if (QObject *object = qLoadPlugin1<QObject, QGenericPluginFactoryInterface>(loader(), driver, specification))
+ return object;
#endif
#endif
return 0;
@@ -101,11 +101,14 @@ QStringList QGenericPluginFactory::keys()
#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
#ifndef QT_NO_LIBRARY
- QStringList plugins = loader()->keys();
- for (int i = 0; i < plugins.size(); ++i) {
- if (!list.contains(plugins.at(i)))
- list += plugins.at(i);
- }
+ typedef QMultiMap<int, QString> PluginKeyMap;
+ typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
+
+ const PluginKeyMap keyMap = loader()->keyMap();
+ const PluginKeyMapConstIterator cend = keyMap.constEnd();
+ for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it)
+ if (!list.contains(it.value()))
+ list += it.value();
#endif //QT_NO_LIBRARY
#endif //QT_MAKEDLL
return list;