Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qpluginloader.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QPLUGINLOADER_H
6#define QPLUGINLOADER_H
7
8#include <QtCore/qglobal.h>
9#if QT_CONFIG(library)
10#include <QtCore/qlibrary.h>
11#endif
12#include <QtCore/qplugin.h>
13
15
16#if QT_CONFIG(library)
17
18class QLibraryPrivate;
19class QJsonObject;
20
21class Q_CORE_EXPORT QPluginLoader : public QObject
22{
23 Q_OBJECT
24 Q_PROPERTY(QString fileName READ fileName WRITE setFileName)
25 Q_PROPERTY(QLibrary::LoadHints loadHints READ loadHints WRITE setLoadHints)
26public:
27 explicit QPluginLoader(QObject *parent = nullptr);
28 explicit QPluginLoader(const QString &fileName, QObject *parent = nullptr);
29 ~QPluginLoader();
30
31 QObject *instance();
32 QJsonObject metaData() const;
33
34 static QObjectList staticInstances();
35 static QList<QStaticPlugin> staticPlugins();
36
37 bool load();
38 bool unload();
39 bool isLoaded() const;
40
41 void setFileName(const QString &fileName);
42 QString fileName() const;
43
44 QString errorString() const;
45
46 void setLoadHints(QLibrary::LoadHints loadHints);
47 QLibrary::LoadHints loadHints() const;
48
49private:
50 QLibraryPrivate *d;
51 bool did_load;
52 Q_DISABLE_COPY(QPluginLoader)
53};
54
55#else
56
57class Q_CORE_EXPORT QPluginLoader
58{
59public:
60 static QObjectList staticInstances();
61 static QList<QStaticPlugin> staticPlugins();
62};
63
64#endif // QT_CONFIG(library)
65
66QT_END_NAMESPACE
67
68#endif // QPLUGINLOADER_H
\inmodule QtCore\reentrant
void setExtraSearchPath(const QString &path)
int indexOf(const QString &needle) const
QMultiMap< int, QString > keyMap() const
MetaDataList metaData() const
QList< QCborArray > metaDataKeys() const
QObject * instance(int index) const
operator QPluginMetaData() const
Definition qplugin.h:187
Combined button and popup list for selecting options.
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)
QT_REQUIRE_CONFIG(cborstreamreader)
Q_TRACE_POINT(qtcore, QFactoryLoader_update, const QString &fileName)
static bool isIidMatch(QByteArrayView raw, QLatin1StringView iid)
static IterationResult iterateInPluginMetaData(QByteArrayView raw, F &&f)
PluginInterface * qLoadPlugin(const QFactoryLoader *loader, const QString &key, Args &&...args)
#define Q_PLUGIN_INSTANCE(IMPLEMENTATION)
Definition qplugin.h:215
#define QT_MOC_EXPORT_PLUGIN_COMMON(PLUGINCLASS, MANGLEDNAME)
Definition qplugin.h:243
QT_BEGIN_NAMESPACE constexpr unsigned char qPluginArchRequirements()
Definition qplugin.h:22
#define Q_EXPORT_PLUGIN2(PLUGIN, PLUGINCLASS)
Definition qplugin.h:262
#define QT_PLUGIN_RESOURCE_INIT
Definition qplugin.h:212
#define QT_PLUGIN_METADATAV2_SECTION
Definition qplugin.h:180
QObject *(* QtPluginInstanceFunction)()
Definition qplugin.h:37
#define QT_PLUGIN_METADATA_SECTION
Definition qplugin.h:140
char name[sizeof(NoteName)]
Definition qplugin.h:93
constexpr ElfNoteHeader(quint32 payloadSize)
Definition qplugin.h:98
static constexpr quint32 NoteType
Definition qplugin.h:86
static constexpr char NoteName[]
Definition qplugin.h:87
quint8 plugin_arch_requirements
Definition qplugin.h:74
char magic[sizeof(QPluginMetaData::MagicString)]
Definition qplugin.h:79
static constexpr void copy(OO(&out)[OSize], II(&in)[ISize])
Definition qplugin.h:46
const void * data
Definition qplugin.h:104
static constexpr quint8 CurrentMetaDataVersion
Definition qplugin.h:40
static constexpr quint8 archRequirements()
Definition qplugin.h:52
static constexpr char MagicString[]
Definition qplugin.h:41
\inmodule QtCore
Definition qplugin.h:111