aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc/src/qmlfunctions.qdoc
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kdab.com>2016-09-04 11:27:18 +0300
committerBogDan Vatra <bogdan@kdab.com>2016-09-07 05:03:26 +0000
commitcd77297bd97bdd70d9526fb9c54ebcca8c081def (patch)
tree9dea80e5f0dc50d30c3a060c33bbedc5f6193c12 /src/qml/doc/src/qmlfunctions.qdoc
parent9c8fc476c68767895a2c4086cb7f5b99c5fa141f (diff)
Add qmlRegisterUncreatableMetaObject convenience function
qmlRegisterUncreatableMetaObject is needed to register Q_NAMESPACE QMetaObjects. Task-number: QTBUG-54982 Change-Id: I767dfcb15db647e0dceb0c37b17e64f2a5c1dd8f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/doc/src/qmlfunctions.qdoc')
-rw-r--r--src/qml/doc/src/qmlfunctions.qdoc36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc
index 26fc40ff37..8b24d19891 100644
--- a/src/qml/doc/src/qmlfunctions.qdoc
+++ b/src/qml/doc/src/qmlfunctions.qdoc
@@ -180,6 +180,42 @@
*/
/*!
+ \fn static inline int qmlRegisterUncreatableMetaObject(const QMetaObject &staticMetaObject, const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& reason)
+ \relates QQmlEngine
+ \since 5.8
+
+ This function registers the \a staticMetaObject and its extension
+ in the QML system with the name \a qmlName in the library imported
+ from \a uri having version number composed from \a versionMajor and
+ \a versionMinor.
+
+ This function is useful to register Q_NAMESPACE namespaces.
+
+ Returns the QML type id.
+
+ Example:
+
+ \code
+ namespace MyNamespace {
+ Q_NAMESPACE
+ enum MyEnum {
+ Key1,
+ Key2,
+ };
+ Q_ENUMS(MyEnum)
+ }
+
+ //...
+ qmlRegisterUncreatableMetaObject(MyNamespace::staticMetaObject, "io.qt", 1, 0, "MyNamespace", "Access to enums & flags only");
+ \endcode
+
+ Now on QML side you can use the registered enums:
+ \code
+ Component.onCompleted: console.log(MyNamespace.Key2)
+ \endcode
+*/
+
+/*!
\fn int qmlRegisterCustomExtendedType(const char *uri, int versionMajor, int versionMinor, const char *qmlName, QQmlCustomParser *parser)
\relates QQmlEngine
\internal