aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/qml/doc/src/qml-extending.qdoc9
-rw-r--r--examples/qml/referenceexamples/methods/example.qml4
2 files changed, 11 insertions, 2 deletions
diff --git a/examples/qml/doc/src/qml-extending.qdoc b/examples/qml/doc/src/qml-extending.qdoc
index 0cb004be7d..b4174426a8 100644
--- a/examples/qml/doc/src/qml-extending.qdoc
+++ b/examples/qml/doc/src/qml-extending.qdoc
@@ -310,6 +310,15 @@ This example builds on:
\li \l {Extending QML - Adding Types Example}
\endlist
+The Methods Example has an additional method in the \c BirthdayParty class: \c invite().
+\c invite() is declared with \l Q_INVOKABLE so that it can be
+called from QML.
+
+\snippet referenceexamples/methods/birthdayparty.h 0
+
+In \c example.qml, the \c invite() method is called in the \l [QML]{QtQml::Component::completed()}{Component.onCompleted} signal handler:
+
+\snippet referenceexamples/methods/example.qml 0
*/
/*!
diff --git a/examples/qml/referenceexamples/methods/example.qml b/examples/qml/referenceexamples/methods/example.qml
index 58985c5d5f..197e6007e1 100644
--- a/examples/qml/referenceexamples/methods/example.qml
+++ b/examples/qml/referenceexamples/methods/example.qml
@@ -38,6 +38,7 @@
**
****************************************************************************/
+// ![0]
import QtQuick 2.0
import People 1.0
@@ -52,7 +53,6 @@ BirthdayParty {
Person { name: "Anne Brown" }
]
-// ![0]
Component.onCompleted: invite("William Green")
-// ![0]
}
+// ![0]