aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2012-07-18 16:14:45 +1000
committerQt by Nokia <qt-info@nokia.com>2012-08-01 12:00:24 +0200
commit1eba1f23a5c0a3ab7941bf508b03b7230646befd (patch)
tree56565243ed952d9f62234ae9e78760e004b74657
parent557890579f11c81182578ba6ab13f2227f6a1824 (diff)
Document qmlAttachedPropertiesObject()
This is discussed in the documentation on writing QML extensions from C++ but is not actually documented in the list of qml* functions. Change-Id: Id24be88dc3fa6d54cc5ee29e3da1686ea2732b39 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
-rw-r--r--src/qml/doc/src/cppintegration/definetypes.qdoc12
-rw-r--r--src/qml/doc/src/qmlfunctions.qdoc23
2 files changed, 34 insertions, 1 deletions
diff --git a/src/qml/doc/src/cppintegration/definetypes.qdoc b/src/qml/doc/src/cppintegration/definetypes.qdoc
index c9750de046..36105e9ba2 100644
--- a/src/qml/doc/src/cppintegration/definetypes.qdoc
+++ b/src/qml/doc/src/cppintegration/definetypes.qdoc
@@ -459,6 +459,16 @@ Additionally, the C++ implementation may access the attached object instance
that has been attached to any object by calling the
qmlAttachedPropertiesObject() function.
+For example:
+
+\code
+Message *msg = someMessageInstance();
+MessageBoardAttachedType *attached =
+ qobject_cast<MessageBoardAttachedType*>(qmlAttachedPropertiesObject<MessageBoard>(msg));
+
+qDebug() << "Value of MessageBoard.expired:" << attached->expired();
+\endcode
+
\section2 Property Value Sources
@@ -655,4 +665,4 @@ public:
};
\endcode
-*/ \ No newline at end of file
+*/
diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc
index cf3527c7d8..c240a02d16 100644
--- a/src/qml/doc/src/qmlfunctions.qdoc
+++ b/src/qml/doc/src/qmlfunctions.qdoc
@@ -251,6 +251,29 @@
*/
/*!
+ \fn Object *qmlAttachedPropertiesObject(const QObject *attachee, bool create = true)
+ \relates QQmlEngine
+
+ The form of this template function is:
+
+ \code
+ template<typename T> QObject *qmlAttachedPropertiesObject(const QObject *attachee, bool create = true)
+ \endcode
+
+ This returns the attached object instance that has been attached to the specified
+ \a attachee by the attaching type \e T.
+
+ If \a create is true and type \e T is a valid attaching type, this creates and returns a new
+ attached object instance.
+
+ Returns 0 if type \e T is not a valid attaching type, or if \a create is false and no
+ attachment object instance has previously been created for \a attachee.
+
+ \sa {Providing Attached Objects for Data Annotations}
+
+*/
+
+/*!
\fn int qmlRegisterModuleApi(const char *uri, int versionMajor, int versionMinor, QObject *(*callback)(QQmlEngine *, QJSEngine *))
\relates QQmlEngine