aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml
diff options
context:
space:
mode:
authorNico Vertriest <nico.vertriest@qt.io>2016-12-21 14:33:32 +0100
committerNico Vertriest <nico.vertriest@theqtcompany.com>2017-01-09 09:38:14 +0000
commita0ed2b0ef3f9259f245294c59e6f4695f29caddd (patch)
treeaa4a4d461fef15604733bbd8e41672e73c8cb6d8 /examples/qml
parent27ea28b0f451076e773f9dc78babfdd799c3e0d8 (diff)
Doc: added specs to Extending QML - Methods Example
Change-Id: I7386c2bd738776455a71bde8cffdcedb9e292b24 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'examples/qml')
-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]