aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-11-09 01:00:06 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-11-09 01:00:07 +0100
commitb01a16ea74e92c78c009f132ef7bc70e91398a98 (patch)
treefca15f247fed71ebfd67e7fda7864612190c42d9 /src/qml/doc
parent6fecfdc769314162d6c909c9ae0a85631964883f (diff)
parent6c08137faf1a53db879701126608833474a2450b (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Diffstat (limited to 'src/qml/doc')
-rw-r--r--src/qml/doc/src/qmlfunctions.qdoc33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc
index 62c0f5d81b..969dd51433 100644
--- a/src/qml/doc/src/qmlfunctions.qdoc
+++ b/src/qml/doc/src/qmlfunctions.qdoc
@@ -356,13 +356,36 @@
*/
/*!
- \fn int qmlRegisterInterface(const char *typeName)
- \relates QQmlEngine
+ \fn int qmlRegisterInterface(const char *typeName)
+ \relates QQmlEngine
- This template function registers the C++ type in the QML system
- under the name \a typeName.
+ This template function registers the C++ type in the QML system
+ under the name \a typeName.
- Returns the QML type id.
+ Types registered as an interface with the engine should also
+ declare themselves as an interface with the
+ \l {The Meta-Object System}{meta object system}. For example:
+
+ \code
+ struct FooInterface
+ {
+ public:
+ virtual ~FooInterface();
+ virtual void doSomething() = 0;
+ };
+
+ Q_DECLARE_INTERFACE(FooInterface, "org.foo.FooInterface")
+ \endcode
+
+ When registered with the QML engine in this way, they can be used as
+ property types:
+
+ Q_PROPERTY(FooInterface *foo READ foo WRITE setFoo)
+
+ When you assign a \l QObject sub-class to this property, the QML engine does
+ the interface cast to \c FooInterface* automatically.
+
+ Returns the QML type id.
*/
/*!