From 4e4403d69c60ea6429b3ad5e7898a84b1dc92be5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 8 May 2012 13:14:09 +0200 Subject: No longer use deprecated methods for plugin loading. Change-Id: I19c66b1c41ea4dd236726c86d7d071b210ec9244 Reviewed-by: Lars Knoll --- src/gui/kernel/qgenericpluginfactory_qpa.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/gui/kernel/qgenericpluginfactory_qpa.cpp') 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(loader()->instance(driver))) - return factory->create(driver, specification); + if (QObject *object = qLoadPlugin1(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 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; -- cgit v1.2.3