From 6c76fdc7616ac3b62c5750600bd6d5985dbceb20 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 19 Jun 2015 13:29:55 +0200 Subject: Allow loading of static plugins if QT_NO_LIBRARY is set. We keep two symbols from QPluginLoader defined, even if QT_NO_LIBRARY is set in order to be able to locate static plugins. This doesn't constitute any loading of shared libraries or plugins from external files at runtime. Using these symbols we can enable most of QFactoryLoader even if QT_NO_LIBRARY is set. Only update(), refreshAll(), library() and the dtor make no sense then. This way QGenericPlugin also becomes useful with QT_NO_LIBRARY. Task-number: QTBUG-3045 Change-Id: Ib7842ce5799e8e2caa46431d95fddd1adda0fc41 Reviewed-by: Thiago Macieira --- src/corelib/plugin/qfactoryloader_p.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/corelib/plugin/qfactoryloader_p.h') diff --git a/src/corelib/plugin/qfactoryloader_p.h b/src/corelib/plugin/qfactoryloader_p.h index 1c48491b0d..ee07084180 100644 --- a/src/corelib/plugin/qfactoryloader_p.h +++ b/src/corelib/plugin/qfactoryloader_p.h @@ -45,17 +45,18 @@ // We mean it. // +#include "QtCore/qglobal.h" +#ifndef QT_NO_QOBJECT + #include "QtCore/qobject.h" #include "QtCore/qstringlist.h" #include "QtCore/qjsonobject.h" #include "QtCore/qmap.h" #include "private/qlibrary_p.h" -#ifndef QT_NO_LIBRARY QT_BEGIN_NAMESPACE class QFactoryLoaderPrivate; - class Q_CORE_EXPORT QFactoryLoader : public QObject { Q_OBJECT @@ -65,21 +66,23 @@ public: explicit QFactoryLoader(const char *iid, const QString &suffix = QString(), Qt::CaseSensitivity = Qt::CaseSensitive); + +#ifndef QT_NO_LIBRARY ~QFactoryLoader(); - QList metaData() const; - QObject *instance(int index) const; + void update(); + static void refreshAll(); #if defined(Q_OS_UNIX) && !defined (Q_OS_MAC) QLibraryPrivate *library(const QString &key) const; -#endif +#endif // Q_OS_UNIX && !Q_OS_MAC +#endif // !QT_NO_LIBRARY QMultiMap keyMap() const; int indexOf(const QString &needle) const; - void update(); - - static void refreshAll(); + QList metaData() const; + QObject *instance(int index) const; }; template @@ -112,6 +115,6 @@ PluginInterface *qLoadPlugin1(const QFactoryLoader *loader, QT_END_NAMESPACE -#endif // QT_NO_LIBRARY +#endif // QT_NO_QOBJECT #endif // QFACTORYLOADER_P_H -- cgit v1.2.3