File indexing completed on 2025-01-18 10:07:33
0001
0002
0003
0004 #ifndef QPLUGINLOADER_H
0005 #define QPLUGINLOADER_H
0006
0007 #include <QtCore/qglobal.h>
0008 #if QT_CONFIG(library)
0009 #include <QtCore/qlibrary.h>
0010 #endif
0011 #include <QtCore/qplugin.h>
0012
0013 QT_BEGIN_NAMESPACE
0014
0015 #if QT_CONFIG(library)
0016
0017 class QLibraryPrivate;
0018 class QJsonObject;
0019
0020 class Q_CORE_EXPORT QPluginLoader : public QObject
0021 {
0022 Q_OBJECT
0023 Q_PROPERTY(QString fileName READ fileName WRITE setFileName)
0024 Q_PROPERTY(QLibrary::LoadHints loadHints READ loadHints WRITE setLoadHints)
0025 public:
0026 explicit QPluginLoader(QObject *parent = nullptr);
0027 explicit QPluginLoader(const QString &fileName, QObject *parent = nullptr);
0028 ~QPluginLoader();
0029
0030 QObject *instance();
0031 QJsonObject metaData() const;
0032
0033 static QObjectList staticInstances();
0034 static QList<QStaticPlugin> staticPlugins();
0035
0036 bool load();
0037 bool unload();
0038 bool isLoaded() const;
0039
0040 void setFileName(const QString &fileName);
0041 QString fileName() const;
0042
0043 QString errorString() const;
0044
0045 void setLoadHints(QLibrary::LoadHints loadHints);
0046 QLibrary::LoadHints loadHints() const;
0047
0048 private:
0049 QLibraryPrivate *d;
0050 bool did_load;
0051 Q_DISABLE_COPY(QPluginLoader)
0052 };
0053
0054 #else
0055
0056 class Q_CORE_EXPORT QPluginLoader
0057 {
0058 public:
0059 static QObjectList staticInstances();
0060 static QList<QStaticPlugin> staticPlugins();
0061 };
0062
0063 #endif
0064
0065 QT_END_NAMESPACE
0066
0067 #endif