summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-03-06 15:05:33 +0100
committerUlf Hermann <ulf.hermann@qt.io>2017-03-06 14:18:50 +0000
commit1c9364698027822516a0b9e28264b5c652b7fd8f (patch)
tree142f859a614b379546f4d5face9df9318a28feb8
parent9ac8d8c272fc93416016e094fc6b97226a400082 (diff)
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>
-rw-r--r--src/feedback/qfeedbackplugin.cpp12
-rw-r--r--src/feedback/qfeedbackpluginsearch.h5
2 files changed, 16 insertions, 1 deletions
diff --git a/src/feedback/qfeedbackplugin.cpp b/src/feedback/qfeedbackplugin.cpp
index 0c32b86..2616f35 100644
--- a/src/feedback/qfeedbackplugin.cpp
+++ b/src/feedback/qfeedbackplugin.cpp
@@ -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);
diff --git a/src/feedback/qfeedbackpluginsearch.h b/src/feedback/qfeedbackpluginsearch.h
index c2699e2..2b946d0 100644
--- a/src/feedback/qfeedbackpluginsearch.h
+++ b/src/feedback/qfeedbackpluginsearch.h
@@ -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