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>
This commit is contained in:
Nico Vertriest 2016-12-21 14:33:32 +01:00 committed by Nico Vertriest
parent 27ea28b0f4
commit a0ed2b0ef3
2 changed files with 11 additions and 2 deletions

View File

@ -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
*/
/*!

View File

@ -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]