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
qqmlextensionplugin.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
4
5#ifndef QQMLEXTENSIONPLUGIN_H
6#define QQMLEXTENSIONPLUGIN_H
7
8#include <QtCore/qplugin.h>
9#include <QtCore/QUrl>
10#include <QtQml/qqmlextensioninterface.h>
11
12#if defined(Q_CC_GHS)
13# define Q_GHS_KEEP_REFERENCE(S) QT_DO_PRAGMA(ghs reference S ##__Fv)
14#else
15# define Q_GHS_KEEP_REFERENCE(S)
16#endif
17
18#define Q_IMPORT_QML_PLUGIN(PLUGIN)
19 Q_IMPORT_PLUGIN(PLUGIN)
20
21QT_BEGIN_NAMESPACE
22
23class QQmlEngine;
24class QQmlExtensionPluginPrivate;
25
26class Q_QML_EXPORT QQmlExtensionPlugin
27 : public QObject
28 , public QQmlExtensionInterface
29{
30 Q_OBJECT
31 Q_DECLARE_PRIVATE(QQmlExtensionPlugin)
32 Q_INTERFACES(QQmlExtensionInterface)
33 Q_INTERFACES(QQmlTypesExtensionInterface)
34public:
35 explicit QQmlExtensionPlugin(QObject *parent = nullptr);
36 ~QQmlExtensionPlugin() override;
37
38#if QT_DEPRECATED_SINCE(6, 3)
39 QT_DEPRECATED_VERSION_X_6_3("Provide a qmldir file to remove the need for calling baseUrl")
40 QUrl baseUrl() const;
41#endif
42
43 void registerTypes(const char *uri) override = 0;
44 virtual void unregisterTypes();
45 void initializeEngine(QQmlEngine *engine, const char *uri) override;
46
47private:
48 Q_DISABLE_COPY(QQmlExtensionPlugin)
49};
50
51class Q_QML_EXPORT QQmlEngineExtensionPlugin
52 : public QObject
53 , public QQmlEngineExtensionInterface
54{
55 Q_OBJECT
56 Q_DISABLE_COPY_MOVE(QQmlEngineExtensionPlugin)
57 Q_INTERFACES(QQmlEngineExtensionInterface)
58public:
59 explicit QQmlEngineExtensionPlugin(QObject *parent = nullptr);
60 ~QQmlEngineExtensionPlugin() override;
61 void initializeEngine(QQmlEngine *engine, const char *uri) override;
62};
63
64QT_END_NAMESPACE
65
66#endif // QQMLEXTENSIONPLUGIN_H
The QQmlEngineExtensionPlugin class provides an abstract base for custom QML extension plugins.
The QQmlExtensionPlugin class provides an abstract base for custom QML extension plugins with custom ...
Combined button and popup list for selecting options.