diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-08-31 12:01:09 +1000 |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-08-31 12:01:09 +1000 |
commit | d01313b94e1eb8f8b9aa088433118459b588a79f (patch) | |
tree | 0cc26a842372e3855654a39b165a3d260d71afd9 /doc | |
parent | 23835db2131dfd25287de44419bae8797d128d21 (diff) |
Improve calling QML functions from C++ docs.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/declarative/extending.qdoc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 5c4d5e7a78..6388764ea0 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -965,6 +965,20 @@ Item { } \endcode +This may be connected to via QObject::connect() or called directly from C++ using +QMetaObject::invokeMethod(): + +\code + QDeclarativeEngine engine; + QDeclarativeContext *context = new QDeclarativeContext(engine.rootContext()); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile("main.qml")); + QObject *object = component.create(context); + QVariant str("Hello"); + QMetaObject::invokeMethod(object, "say", Q_ARG(QVariant, str)); +\endcode + +Return values of type QVariant are also supported via Q_RETURN_ARG. + \section1 Defining new Components \target components |