diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-05-08 13:14:09 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-09 13:40:23 +0200 |
commit | 4e4403d69c60ea6429b3ad5e7898a84b1dc92be5 (patch) | |
tree | 4d8c3f222412438643fe54508036a452c6967152 /src/widgets/styles/qstylefactory.cpp | |
parent | b316c3ac5e4acac75505bfd77677cecc181599af (diff) |
No longer use deprecated methods for plugin loading.
Change-Id: I19c66b1c41ea4dd236726c86d7d071b210ec9244
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/widgets/styles/qstylefactory.cpp')
-rw-r--r-- | src/widgets/styles/qstylefactory.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp index 9ed452b516..ec29ae7b99 100644 --- a/src/widgets/styles/qstylefactory.cpp +++ b/src/widgets/styles/qstylefactory.cpp @@ -181,10 +181,8 @@ QStyle *QStyleFactory::create(const QString& key) #endif { } // Keep these here - they make the #ifdefery above work #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) - if(!ret) { - if (QStyleFactoryInterface *factory = qobject_cast<QStyleFactoryInterface*>(loader()->instance(style))) - ret = factory->create(style); - } + if (!ret) + ret = qLoadPlugin<QStyle, QStyleFactoryInterface>(loader(), style); #endif if(ret) ret->setObjectName(style); @@ -199,10 +197,15 @@ QStyle *QStyleFactory::create(const QString& key) */ QStringList QStyleFactory::keys() { -#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) - QStringList list = loader()->keys(); -#else QStringList list; +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + typedef QMultiMap<int, QString> PluginKeyMap; + typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator; + + const PluginKeyMap keyMap = loader()->keyMap(); + const PluginKeyMap::const_iterator cend = keyMap.constEnd(); + for (PluginKeyMap::const_iterator it = keyMap.constBegin(); it != cend; ++it) + list.append(it.value()); #endif #ifndef QT_NO_STYLE_WINDOWS if (!list.contains(QLatin1String("Windows"))) |