QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
{
accessibility_active = true;
- QAccessibleInterface *iface = 0;
if (!object)
return 0;
const QMetaObject *mo = object->metaObject();
while (mo) {
- const QLatin1String cn(mo->className());
+ const QString cn = QLatin1String(mo->className());
for (int i = qAccessibleFactories()->count(); i > 0; --i) {
InterfaceFactory factory = qAccessibleFactories()->at(i - 1);
- iface = factory(cn, object);
- if (iface)
+ if (QAccessibleInterface *iface = factory(cn, object))
return iface;
}
#ifndef QT_NO_LIBRARY
- QAccessibleFactoryInterface *factory = qobject_cast<QAccessibleFactoryInterface*>(loader()->instance(cn));
- if (factory) {
- iface = factory->create(cn, object);
- if (iface)
- return iface;
- }
+ if (QAccessibleInterface * iface = qLoadPlugin1<QAccessibleInterface, QAccessibleFactoryInterface>(loader(), cn, object))
+ return iface;
#endif
mo = mo->superClass();
}
- if (!iface) {
- if (object == qApp)
- iface = new QAccessibleApplication;
- }
- return iface;
+ if (object == qApp)
+ return new QAccessibleApplication;
+
+ return 0;
}
/*!
isInit = true; // ### not atomic
#ifndef QT_NO_LIBRARY
- const QStringList l = bridgeloader()->keys();
- for (int i = 0; i < l.count(); ++i) {
- if (QAccessibleBridgeFactoryInterface *factory =
- qobject_cast<QAccessibleBridgeFactoryInterface*>(bridgeloader()->instance(l.at(i)))) {
- QAccessibleBridge * bridge = factory->create(l.at(i));
- if (bridge) {
- bridges()->append(bridge);
- }
+ typedef QMultiMap<int, QString> PluginKeyMap;
+ typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
+
+ const PluginKeyMap keyMap = bridgeloader()->keyMap();
+ QAccessibleBridgeFactoryInterface *factory = 0;
+ int i = -1;
+ const PluginKeyMapConstIterator cend = keyMap.constEnd();
+ for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) {
+ if (it.key() != i) {
+ i = it.key();
+ factory = qobject_cast<QAccessibleBridgeFactoryInterface*>(bridgeloader()->instance(i));
}
+ if (factory)
+ if (QAccessibleBridge *bridge = factory->create(it.value()))
+ bridges()->append(bridge);
}
#endif
}
QImageIOHandler *handler = 0;
#ifndef QT_NO_LIBRARY
+ typedef QMultiMap<int, QString> PluginKeyMap;
+ typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
+
// check if we have plugins that support the image format
QFactoryLoader *l = loader();
- QStringList keys = l->keys();
+ const PluginKeyMap keyMap = l->keyMap();
#endif
QByteArray suffix;
#ifdef QIMAGEREADER_DEBUG
qDebug() << "QImageReader::createReadHandler( device =" << (void *)device << ", format =" << format << "),"
- << keys.size() << "plugins available: " << keys;
+ << keyMap.values().size() << "plugins available: " << keyMap.values();
#endif
#ifndef QT_NO_LIBRARY
qDebug() << "QImageReader::createReadHandler: device is a file:" << file->fileName();
#endif
if (!(suffix = QFileInfo(file->fileName()).suffix().toLower().toLatin1()).isEmpty()) {
- int index = keys.indexOf(QString::fromLatin1(suffix));
+ const int index = keyMap.key(QString::fromLatin1(suffix), -1);
if (index != -1) {
#ifdef QIMAGEREADER_DEBUG
qDebug() << "QImageReader::createReadHandler: suffix recognized; the"
// check if the plugin that claims support for this format can load
// from this device with this format.
const qint64 pos = device ? device->pos() : 0;
- QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(QString::fromLatin1(suffix)));
- if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) {
- handler = plugin->create(device, testFormat);
+ const int index = keyMap.key(QString::fromLatin1(suffix), -1);
+ if (index != -1) {
+ QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(index));
+ if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) {
+ handler = plugin->create(device, testFormat);
#ifdef QIMAGEREADER_DEBUG
- qDebug() << "QImageReader::createReadHandler: using the" << suffix
- << "plugin";
+ qDebug() << "QImageReader::createReadHandler: using the" << suffix
+ << "plugin";
#endif
+ }
}
if (device && !device->isSequential())
device->seek(pos);
const qint64 pos = device ? device->pos() : 0;
if (autoDetectImageFormat) {
- for (int i = 0; i < keys.size(); ++i) {
+ const int keyCount = keyMap.keys().size();
+ for (int i = 0; i < keyCount; ++i) {
if (i != suffixPluginIndex) {
- QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(keys.at(i)));
+ QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(i));
if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) {
#ifdef QIMAGEREADER_DEBUG
qDebug() << "QImageReader::createReadHandler: the" << keys.at(i) << "plugin can read this format";
}
}
} else {
- QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(QLatin1String(testFormat)));
- if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) {
+ const int testIndex = keyMap.key(QLatin1String(testFormat), -1);
+ if (testIndex != -1) {
+ QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(testIndex));
+ if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) {
#ifdef QIMAGEREADER_DEBUG
- qDebug() << "QImageReader::createReadHandler: the" << testFormat << "plugin can read this format";
+ qDebug() << "QImageReader::createReadHandler: the" << testFormat << "plugin can read this format";
#endif
- handler = plugin->create(device, testFormat);
+ handler = plugin->create(device, testFormat);
+ }
}
}
if (device && !device->isSequential())
if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) {
// check if any of our plugins recognize the file from its contents.
const qint64 pos = device ? device->pos() : 0;
- for (int i = 0; i < keys.size(); ++i) {
+ const int keyCount = keyMap.keys().size();
+ for (int i = 0; i < keyCount; ++i) {
if (i != suffixPluginIndex) {
- QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(keys.at(i)));
+ QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(i));
if (plugin && plugin->capabilities(device, QByteArray()) & QImageIOPlugin::CanRead) {
handler = plugin->create(device, testFormat);
#ifdef QIMAGEREADER_DEBUG
return format;
}
+#ifndef QT_NO_LIBRARY
+void supportedImageHandlerFormats(QFactoryLoader *loader,
+ QImageIOPlugin::Capability cap,
+ QSet<QByteArray> *result);
+#endif
+
/*!
Returns the list of image formats supported by QImageReader.
\sa setFormat(), QImageWriter::supportedImageFormats(), QImageIOPlugin
*/
+
QList<QByteArray> QImageReader::supportedImageFormats()
{
QSet<QByteArray> formats;
formats << _qt_BuiltInFormats[i].extension;
#ifndef QT_NO_LIBRARY
- QFactoryLoader *l = loader();
- QStringList keys = l->keys();
-
- for (int i = 0; i < keys.count(); ++i) {
- QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(keys.at(i)));
- if (plugin && plugin->capabilities(0, keys.at(i).toLatin1()) & QImageIOPlugin::CanRead)
- formats << keys.at(i).toLatin1();
- }
+ supportedImageHandlerFormats(loader(), QImageIOPlugin::CanRead, &formats);
#endif // QT_NO_LIBRARY
QList<QByteArray> sortedFormats;
QImageIOHandler *handler = 0;
#ifndef QT_NO_LIBRARY
+ typedef QMultiMap<int, QString> PluginKeyMap;
+ typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
+
// check if any plugins can write the image
QFactoryLoader *l = loader();
- QStringList keys = l->keys();
+ const PluginKeyMap keyMap = l->keyMap();
int suffixPluginIndex = -1;
#endif
if (QFile *file = qobject_cast<QFile *>(device)) {
if (!(suffix = QFileInfo(file->fileName()).suffix().toLower().toLatin1()).isEmpty()) {
#ifndef QT_NO_LIBRARY
- int index = keys.indexOf(QString::fromLatin1(suffix));
+ const int index = keyMap.key(QString::fromLatin1(suffix), -1);
if (index != -1)
suffixPluginIndex = index;
#endif
if (suffixPluginIndex != -1) {
// when format is missing, check if we can find a plugin for the
// suffix.
- QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(QString::fromLatin1(suffix)));
- if (plugin && (plugin->capabilities(device, suffix) & QImageIOPlugin::CanWrite))
- handler = plugin->create(device, suffix);
+ const int index = keyMap.key(QString::fromLatin1(suffix), -1);
+ if (index != -1) {
+ QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(index));
+ if (plugin && (plugin->capabilities(device, suffix) & QImageIOPlugin::CanWrite))
+ handler = plugin->create(device, suffix);
+ }
}
#endif // QT_NO_LIBRARY
#ifndef QT_NO_LIBRARY
if (!testFormat.isEmpty()) {
- for (int i = 0; i < keys.size(); ++i) {
- QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(keys.at(i)));
+ const int keyCount = keyMap.keys().size();
+ for (int i = 0; i < keyCount; ++i) {
+ QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(i));
if (plugin && (plugin->capabilities(device, testFormat) & QImageIOPlugin::CanWrite)) {
delete handler;
handler = plugin->create(device, testFormat);
return d->handler->supportsOption(option);
}
+
+#ifndef QT_NO_LIBRARY
+void supportedImageHandlerFormats(QFactoryLoader *loader,
+ QImageIOPlugin::Capability cap,
+ QSet<QByteArray> *result)
+{
+ typedef QMultiMap<int, QString> PluginKeyMap;
+ typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
+
+ const PluginKeyMap keyMap = loader->keyMap();
+ const PluginKeyMapConstIterator cend = keyMap.constEnd();
+ int i = -1;
+ QImageIOPlugin *plugin = 0;
+ for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) {
+ if (it.key() != i) {
+ i = it.key();
+ plugin = qobject_cast<QImageIOPlugin *>(loader->instance(i));
+ }
+ const QByteArray key = it.value().toLatin1();
+ if (plugin && (plugin->capabilities(0, key) & cap) != 0)
+ result->insert(key);
+ }
+}
+#endif // QT_NO_LIBRARY
+
/*!
Returns the list of image formats supported by QImageWriter.
#endif
#ifndef QT_NO_LIBRARY
- QFactoryLoader *l = loader();
- QStringList keys = l->keys();
- for (int i = 0; i < keys.count(); ++i) {
- QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(keys.at(i)));
- if (plugin && (plugin->capabilities(0, keys.at(i).toLatin1()) & QImageIOPlugin::CanWrite) != 0)
- formats << keys.at(i).toLatin1();
- }
+ supportedImageHandlerFormats(loader(), QImageIOPlugin::CanWrite, &formats);
#endif // QT_NO_LIBRARY
QList<QByteArray> sortedFormats;
void qt_init_picture_plugins()
{
#ifndef QT_NO_LIBRARY
+ typedef QMultiMap<int, QString> PluginKeyMap;
+ typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
+
static QBasicMutex mutex;
QMutexLocker locker(&mutex);
static QFactoryLoader loader(QPictureFormatInterface_iid,
QStringLiteral("/pictureformats"));
- QStringList keys = loader.keys();
- for (int i = 0; i < keys.count(); ++i)
- if (QPictureFormatInterface *format = qobject_cast<QPictureFormatInterface*>(loader.instance(keys.at(i))))
- format->installIOHandler(keys.at(i));
+
+ const PluginKeyMap keyMap = loader.keyMap();
+ const PluginKeyMapConstIterator cend = keyMap.constEnd();
+ for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) {
+ if (QPictureFormatInterface *format = qobject_cast<QPictureFormatInterface*>(loader.instance(it.key())))
+ format->installIOHandler(it.value());
+ }
#endif
}
*/
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;
#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;
#include <qpa/qplatformintegrationplugin.h>
#include "private/qfactoryloader_p.h"
#include "qmutex.h"
+#include "qdir.h"
#include "qguiapplication.h"
#include "qdebug.h"
QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key, const QString &platformPluginPath)
{
- QPlatformIntegration *ret = 0;
QStringList paramList = key.split(QLatin1Char(':'));
- QString platform = paramList.takeFirst().toLower();
+ const QString platform = paramList.takeFirst().toLower();
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
// Try loading the plugin from platformPluginPath first:
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
- if (QPlatformIntegrationFactoryInterface *factory =
- qobject_cast<QPlatformIntegrationFactoryInterface*>(directLoader()->instance(platform)))
- ret = factory->create(key, paramList);
-
- if (ret)
+ if (QPlatformIntegration *ret = qLoadPlugin1<QPlatformIntegration, QPlatformIntegrationFactoryInterface >(directLoader(), platform, paramList))
return ret;
}
- if (QPlatformIntegrationFactoryInterface *factory = qobject_cast<QPlatformIntegrationFactoryInterface*>(loader()->instance(platform)))
- ret = factory->create(platform, paramList);
+ if (QPlatformIntegration *ret = qLoadPlugin1<QPlatformIntegration, QPlatformIntegrationFactoryInterface >(loader(), platform, paramList))
+ return ret;
#endif
-
- return ret;
+ return 0;
}
/*!
\sa create()
*/
+
QStringList QPlatformIntegrationFactory::keys(const QString &platformPluginPath)
{
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
QStringList list;
-
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
- foreach (const QString &key, directLoader()->keys()) {
- list += key + QString(QLatin1String(" (from %1)")).arg(platformPluginPath);
+ list = directLoader()->keyMap().values();
+ if (!list.isEmpty()) {
+ const QString postFix = QStringLiteral(" (from ")
+ + QDir::toNativeSeparators(platformPluginPath)
+ + QLatin1Char(')');
+ const QStringList::iterator end = list.end();
+ for (QStringList::iterator it = list.begin(); it != end; ++it)
+ (*it).append(postFix);
}
}
-
- list += loader()->keys();
+ list.append(loader()->keyMap().values());
+ return list;
#else
- QStringList list;
+ return QStringList();
#endif
- return list;
}
QT_END_NAMESPACE
#include <qpa/qplatformthemefactory_p.h>
#include <qpa/qplatformthemeplugin.h>
+#include <QDir>
#include "private/qfactoryloader_p.h"
#include "qmutex.h"
QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString &platformPluginPath)
{
- QPlatformTheme *ret = 0;
QStringList paramList = key.split(QLatin1Char(':'));
- QString platform = paramList.takeFirst().toLower();
+ const QString platform = paramList.takeFirst().toLower();
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
// Try loading the plugin from platformPluginPath first:
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
- if (QPlatformThemeFactoryInterface *factory =
- qobject_cast<QPlatformThemeFactoryInterface*>(directLoader()->instance(platform)))
- ret = factory->create(key, paramList);
-
- if (ret)
+ if (QPlatformTheme *ret = qLoadPlugin1<QPlatformTheme, QPlatformThemeFactoryInterface>(directLoader(), platform, paramList))
return ret;
}
- if (QPlatformThemeFactoryInterface *factory = qobject_cast<QPlatformThemeFactoryInterface*>(loader()->instance(platform)))
- ret = factory->create(platform, paramList);
+ if (QPlatformTheme *ret = qLoadPlugin1<QPlatformTheme, QPlatformThemeFactoryInterface>(loader(), platform, paramList))
+ return ret;
#endif
-
- return ret;
+ return 0;
}
/*!
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
- foreach (const QString &key, directLoader()->keys()) {
- list += key + QString(QLatin1String(" (from %1)")).arg(platformPluginPath);
+ list += directLoader()->keyMap().values();
+ if (!list.isEmpty()) {
+ const QString postFix = QStringLiteral(" (from ")
+ + QDir::toNativeSeparators(platformPluginPath)
+ + QLatin1Char(')');
+ const QStringList::iterator end = list.end();
+ for (QStringList::iterator it = list.begin(); it != end; ++it)
+ (*it).append(postFix);
}
}
-
- list += loader()->keys();
+ list += loader()->keyMap().values();
+ return list;
#else
- QStringList list;
+ return QStringList();
#endif
- return list;
}
QT_END_NAMESPACE
void QNetworkConfigurationManagerPrivate::updateConfigurations()
{
+#ifndef QT_NO_LIBRARY
+ typedef QMultiMap<int, QString> PluginKeyMap;
+ typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
+#endif
QMutexLocker locker(&mutex);
if (firstUpdate) {
#ifndef QT_NO_LIBRARY
QBearerEngine *generic = 0;
-
QFactoryLoader *l = loader();
- foreach (const QString &key, l->keys()) {
- QBearerEnginePlugin *plugin = qobject_cast<QBearerEnginePlugin *>(l->instance(key));
- if (plugin) {
- QBearerEngine *engine = plugin->create(key);
- if (!engine)
- continue;
-
+ const PluginKeyMap keyMap = l->keyMap();
+ const PluginKeyMapConstIterator cend = keyMap.constEnd();
+ for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) {
+ const QString &key = it.value();
+ if (QBearerEngine *engine = qLoadPlugin<QBearerEngine, QBearerEnginePlugin>(l, key)) {
if (key == QLatin1String("generic"))
generic = engine;
else
{
static QPlatformPrinterSupport *singleton = 0;
if (!singleton) {
- QStringList k = loader()->keys();
- if (k.isEmpty())
- return 0;
- QPlatformPrinterSupportPlugin *plugin = qobject_cast<QPlatformPrinterSupportPlugin *>(loader()->instance(k.first()));
- if (!plugin)
- return 0;
- singleton = plugin->create(k.first());
+ const QMultiMap<int, QString> keyMap = loader()->keyMap();
+ if (!keyMap.isEmpty())
+ singleton = qLoadPlugin<QPlatformPrinterSupport, QPlatformPrinterSupportPlugin>(loader(), keyMap.constBegin().value());
}
return singleton;
}
#ifndef QT_NO_LIBRARY
if (QFactoryLoader *fl = loader()) {
- QStringList keys = fl->keys();
- for (QStringList::const_iterator i = keys.constBegin(); i != keys.constEnd(); ++i) {
- if (!list.contains(*i))
- list << *i;
- }
+ typedef QMultiMap<int, QString> PluginKeyMap;
+ typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
+
+ const PluginKeyMap keyMap = fl->keyMap();
+ const PluginKeyMapConstIterator cend = keyMap.constEnd();
+ for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it)
+ if (!list.contains(it.value()))
+ list << it.value();
}
#endif
}
#ifndef QT_NO_LIBRARY
- if (!driver && loader()) {
- if (QSqlDriverFactoryInterface *factory = qobject_cast<QSqlDriverFactoryInterface*>(loader()->instance(type)))
- driver = factory->create(type);
- }
+ if (!driver && loader())
+ driver = qLoadPlugin<QSqlDriver, QSqlDriverFactoryInterface>(loader(), type);
#endif // QT_NO_LIBRARY
if (!driver) {
QString suffix = info.suffix();
if (!suffix.isEmpty()) {
// first try version 2 engines..
- if (QIconEngineFactoryInterface *factory = qobject_cast<QIconEngineFactoryInterface*>(loader()->instance(suffix))) {
- if (QIconEngine *engine = factory->create(fileName)) {
- d = new QIconPrivate;
- d->engine = engine;
+ const int index = loader()->indexOf(suffix);
+ if (index != -1) {
+ if (QIconEngineFactoryInterface *factory = qobject_cast<QIconEngineFactoryInterface*>(loader()->instance(index))) {
+ if (QIconEngine *engine = factory->create(fileName)) {
+ d = new QIconPrivate;
+ d->engine = engine;
+ }
}
}
}
icon.d->engine = engine;
engine->read(s);
#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
- } else if (QIconEngineFactoryInterface *factory = qobject_cast<QIconEngineFactoryInterface*>(loader()->instance(key))) {
- if (QIconEngine *engine= factory->create()) {
- icon.d = new QIconPrivate;
- icon.d->engine = engine;
- engine->read(s);
- }
+ } else {
+ const int index = loader()->indexOf(key);
+ if (index != -1) {
+ if (QIconEngineFactoryInterface *factory = qobject_cast<QIconEngineFactoryInterface*>(loader()->instance(index))) {
+ if (QIconEngine *engine= factory->create()) {
+ icon.d = new QIconPrivate;
+ icon.d->engine = engine;
+ engine->read(s);
+ } // factory
+ } // instance
+ } // index
#endif
}
} else if (s.version() == QDataStream::Qt_4_2) {
QFactoryLoader iconFactoryLoader(QIconEngineFactoryInterface_iid,
QLatin1String("/iconengines"),
Qt::CaseInsensitive);
- if (iconFactoryLoader.keys().contains(QLatin1String("svg")))
+ if (iconFactoryLoader.keyMap().key(QLatin1String("svg"), -1) != -1)
m_supportsSvg = true;
#endif //QT_NO_LIBRARY
}
#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);
*/
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")))