mirror of https://github.com/qt/qtfeedback.git
Fix build with -no-feature-library
Disable code that directly interacts with QPluginLoader or relies on QCoreApplication::libraryPaths(). For loading plugins from inside Qt code you can use QFactoryLoader. If QPluginLoader is necessary, please consider staticPlugins() and staticInstances(). Change-Id: I14e2e2b5437ddd74109a94cc47dd53f4459ea2f5 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This commit is contained in:
parent
9ac8d8c272
commit
1c93646980
|
@ -120,13 +120,18 @@ class BackendLoader
|
|||
{
|
||||
public:
|
||||
BackendLoader() : inst(0) { }
|
||||
~BackendLoader() { pl.unload(); }
|
||||
~BackendLoader() {
|
||||
#if QT_CONFIG(library)
|
||||
pl.unload();
|
||||
#endif
|
||||
}
|
||||
|
||||
void setInstance(T *newInst) { inst = newInst; }
|
||||
T * instance() { return inst; }
|
||||
|
||||
void tryLoad(QPluginLoader &loader)
|
||||
{
|
||||
#if QT_CONFIG(library)
|
||||
if (T *newInst = qobject_cast<T*>(loader.instance())) {
|
||||
if (!inst || inst->pluginPriority() < newInst->pluginPriority()) {
|
||||
inst = newInst;
|
||||
|
@ -135,6 +140,9 @@ public:
|
|||
pl.load(); //Adds a ref to the library
|
||||
}
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(loader)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -252,6 +260,7 @@ class BackendManager
|
|||
public:
|
||||
BackendManager()
|
||||
{
|
||||
#if QT_CONFIG(library)
|
||||
QStringList pluginPaths = getPluginPaths(QLatin1String("feedback"));
|
||||
|
||||
foreach (const QString& pluginPath, pluginPaths) {
|
||||
|
@ -266,6 +275,7 @@ public:
|
|||
loader.unload();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!hapticsBackend.instance())
|
||||
hapticsBackend.setInstance(new QDummyBackend);
|
||||
|
|
|
@ -47,6 +47,7 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
inline QStringList getPluginPaths(const QString& plugintype)
|
||||
{
|
||||
#if QT_CONFIG(library)
|
||||
#if !defined QT_NO_DEBUG
|
||||
const bool showDebug = qgetenv("QT_DEBUG_PLUGINS").toInt() > 0;
|
||||
#endif
|
||||
|
@ -106,6 +107,10 @@ inline QStringList getPluginPaths(const QString& plugintype)
|
|||
}
|
||||
|
||||
return plugins;
|
||||
#else
|
||||
Q_UNUSED(plugintype)
|
||||
return QStringList();
|
||||
#endif
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
Loading…
Reference in New Issue