aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlprivate.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-02-11 19:15:59 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-02-12 17:42:11 +0100
commita2b31f073530f61203fe0e9799ad158c4fe6b9f9 (patch)
tree4edd506b2acd258376b187ad4950154421126809 /src/qml/qml/qqmlprivate.h
parentc70452a65af222343451f19ec62744314444c181 (diff)
Add a static variant of qmlRegisterInterface()
qmlRegisterInterface() should not be called procedurally, for the same reason that qmlRegisterType() should not be called procedurally. Also, add URI and major version parameters to qmlRegisterInterface(), and deprecate the typeName parameter. We want to identify which import an interface belongs to. Task-number: QTBUG-68796 Change-Id: Iba3d66e5ce6219b30aadba34396f12fca92f35a7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlprivate.h')
-rw-r--r--src/qml/qml/qqmlprivate.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h
index 9504fc37dc..9d260f5e94 100644
--- a/src/qml/qml/qqmlprivate.h
+++ b/src/qml/qml/qqmlprivate.h
@@ -406,6 +406,9 @@ namespace QQmlPrivate
int listId;
const char *iid;
+
+ const char *uri;
+ int versionMajor;
};
struct RegisterAutoParent {
@@ -579,6 +582,18 @@ namespace QQmlPrivate
static constexpr bool Value = bool(T::QmlIsSingleton::yes);
};
+ template<class T, class = QmlVoidT<>>
+ struct QmlInterface
+ {
+ static constexpr bool Value = false;
+ };
+
+ template<class T>
+ struct QmlInterface<T, QmlVoidT<typename T::QmlIsInterface>>
+ {
+ static constexpr bool Value = bool(T::QmlIsInterface::yes);
+ };
+
template<typename T>
void qmlRegisterSingletonAndRevisions(const char *uri, int versionMajor,
const QMetaObject *classInfoMetaObject)