summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-08-31 02:01:09 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-08-31 02:01:09 (GMT)
commitd01313b94e1eb8f8b9aa088433118459b588a79f (patch)
tree0cc26a842372e3855654a39b165a3d260d71afd9
parent23835db2131dfd25287de44419bae8797d128d21 (diff)
downloadQt-d01313b94e1eb8f8b9aa088433118459b588a79f.zip
Qt-d01313b94e1eb8f8b9aa088433118459b588a79f.tar.gz
Qt-d01313b94e1eb8f8b9aa088433118459b588a79f.tar.bz2
Improve calling QML functions from C++ docs.
-rw-r--r--doc/src/declarative/extending.qdoc14
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc
index 5c4d5e7..6388764 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