diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-10-01 14:43:37 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-10-14 10:42:29 +0200 |
commit | ee62b2824fe91e95a3f8218b93ba55a2ef6660d0 (patch) | |
tree | ff403362ee4b73c9d90c640d29bf22a0aba94c23 /src/qml/qml/qqmlextensioninterface.h | |
parent | 8cb08ca42157bb43b523103a6d1be94534be0597 (diff) |
Add support for semi-automatic QML type registrations
We can use the new moc JSON output to collect all meta-objects at build
time and, for those that include QML element registration meta-data,
generate code that automatically registers these types with QML. This
eliminates the need to call qmlRegisterType manually.
For now this generates free-standing functions (per module) that need to
be called manually. This is intended as an intermediate step.
Task-number: QTBUG-68796
Change-Id: Ib414eef9757344feee488ebc7388f957b975347f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlextensioninterface.h')
-rw-r--r-- | src/qml/qml/qqmlextensioninterface.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlextensioninterface.h b/src/qml/qml/qqmlextensioninterface.h index d2eb79c5c9..1490bc512e 100644 --- a/src/qml/qml/qqmlextensioninterface.h +++ b/src/qml/qml/qqmlextensioninterface.h @@ -62,8 +62,14 @@ public: virtual void initializeEngine(QQmlEngine *engine, const char *uri) = 0; }; -#define QQmlTypesExtensionInterface_iid "org.qt-project.Qt.QQmlTypesExtensionInterface" +class Q_QML_EXPORT QQmlEngineExtensionInterface +{ +public: + virtual ~QQmlEngineExtensionInterface() = default; + virtual void initializeEngine(QQmlEngine *engine, const char *uri) = 0; +}; +#define QQmlTypesExtensionInterface_iid "org.qt-project.Qt.QQmlTypesExtensionInterface" Q_DECLARE_INTERFACE(QQmlTypesExtensionInterface, "org.qt-project.Qt.QQmlTypesExtensionInterface/1.0") // NOTE: When changing this to a new version and deciding to add backup code to @@ -73,6 +79,9 @@ Q_DECLARE_INTERFACE(QQmlTypesExtensionInterface, "org.qt-project.Qt.QQmlTypesExt Q_DECLARE_INTERFACE(QQmlExtensionInterface, QQmlExtensionInterface_iid) +#define QQmlEngineExtensionInterface_iid "org.qt-project.Qt.QQmlEngineExtensionInterface" +Q_DECLARE_INTERFACE(QQmlEngineExtensionInterface, QQmlEngineExtensionInterface_iid) + QT_END_NAMESPACE #endif // QQMLEXTENSIONINTERFACE_H |