diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-06-17 15:42:05 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-06-24 18:26:14 +0200 |
commit | 36df81b3bc6d721d5598d5163b0a9659de4a69ee (patch) | |
tree | d9032e08f4d27daa9e4b16a2c2e622ed2fa6951b /src/qml/qml/qqml.h | |
parent | 6de0287d7c3aa4251fe6eb4f970d73ce11cf07fc (diff) |
Discern between "auto" and versioned imports in qmldirs
You can now import the latest version, a specific version, or, "auto"
which is the same version as the parent module.
[ChangeLog][QtQml] You can now procedurally add module imports to
modules, using qmlRegisterModuleImport(). However, actual import
statements in qmldir files should be preferred wherever possible.
Fixes: QTBUG-84899
Change-Id: I3b32dd8b07a19d31b6538b9a6bb436840862f345
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqml.h')
-rw-r--r-- | src/qml/qml/qqml.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h index ee3afa768a..ae72d90875 100644 --- a/src/qml/qml/qqml.h +++ b/src/qml/qml/qqml.h @@ -675,8 +675,20 @@ QT_WARNING_POP Q_QML_EXPORT bool qmlProtectModule(const char* uri, int majVersion); Q_QML_EXPORT void qmlRegisterModule(const char *uri, int versionMajor, int versionMinor); -Q_QML_EXPORT void qmlRegisterModuleImport(const char *uri, int majorVersion, const char *import); -Q_QML_EXPORT void qmlUnregisterModuleImport(const char *uri, int majorVersion, const char *import); +enum QQmlModuleImportSpecialVersions: int { + QQmlModuleImportModuleAny = -1, + QQmlModuleImportLatest = -1, + QQmlModuleImportAuto = -2 +}; + +Q_QML_EXPORT void qmlRegisterModuleImport(const char *uri, int moduleMajor, + const char *import, + int importMajor = QQmlModuleImportLatest, + int importMinor = QQmlModuleImportLatest); +Q_QML_EXPORT void qmlUnregisterModuleImport(const char *uri, int moduleMajor, + const char *import, + int importMajor = QQmlModuleImportLatest, + int importMinor = QQmlModuleImportLatest); template<typename T> QObject *qmlAttachedPropertiesObject(const QObject *obj, bool create = true) |