diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2017-03-06 14:59:49 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-10-20 09:36:22 +0000 |
commit | d964eab8e570b786ae7ddc7312d7888aa10f5290 (patch) | |
tree | 582de114640c0b5cd1832fe1406c17a7ee760270 /src/render/io | |
parent | 87b21f81b89efb451291d94d310402ba944f33e3 (diff) |
Improve plugin loading with -no-feature-library
Drop an unused include and make more of an effort to load (possibly
static) QInputDeviceIntegration and QSceneImportFactory plugins.
pluginPath was unused in qsceneimportfactory.cpp in this case, and
generated compile warnings.
Change-Id: I033c5bace84018a9e6c640b4318f2d34b91f7c19
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/render/io')
-rw-r--r-- | src/render/io/qsceneimportfactory.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/render/io/qsceneimportfactory.cpp b/src/render/io/qsceneimportfactory.cpp index d336c7003..587722a35 100644 --- a/src/render/io/qsceneimportfactory.cpp +++ b/src/render/io/qsceneimportfactory.cpp @@ -49,16 +49,16 @@ QT_BEGIN_NAMESPACE namespace Qt3DRender { -#ifndef QT_NO_LIBRARY Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QSceneImportFactoryInterface_iid, QLatin1String("/sceneparsers"), Qt::CaseInsensitive)) +#ifndef QT_NO_LIBRARY Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, (QSceneImportFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) #endif QStringList QSceneImportFactory::keys(const QString &pluginPath) { -#ifndef QT_NO_LIBRARY QStringList list; if (!pluginPath.isEmpty()) { +#if QT_CONFIG(library) QCoreApplication::addLibraryPath(pluginPath); list = directLoader()->keyMap().values(); if (!list.isEmpty()) { @@ -69,26 +69,28 @@ QStringList QSceneImportFactory::keys(const QString &pluginPath) for (QStringList::iterator it = list.begin(); it != end; ++it) (*it).append(postFix); } +#else + qWarning() << QSceneImporter::tr("Cannot query QSceneImporter plugins at %1. " + "Library loading is disabled.").arg(pluginPath); +#endif } list.append(loader()->keyMap().values()); return list; -#else - return QStringList(); -#endif } QSceneImporter *QSceneImportFactory::create(const QString &name, const QStringList &args, const QString &pluginPath) { -#ifndef QT_NO_LIBRARY if (!pluginPath.isEmpty()) { +#if QT_CONFIG(library) QCoreApplication::addLibraryPath(pluginPath); if (QSceneImporter *ret = qLoadPlugin<QSceneImporter, QSceneImportPlugin>(directLoader(), name, args)) return ret; - } - if (QSceneImporter *ret = qLoadPlugin<QSceneImporter, QSceneImportPlugin>(loader(), name, args)) - return ret; +#else + qWarning() << QSceneImporter::tr("Cannot load QSceneImporter plugin from %1. " + "Library loading is disabled.").arg(pluginPath); #endif - return nullptr; + } + return qLoadPlugin<QSceneImporter, QSceneImportPlugin>(loader(), name, args); } } // namespace Qt3DRender |