summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeexpression.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-07-07 04:12:19 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-07-07 04:12:19 (GMT)
commitb4b1b118015d1dcef63b065a609234a18f332ba4 (patch)
tree3ed0cd064a056e02b44dbc2b0f9df92c09359d39 /src/declarative/qml/qdeclarativeexpression.cpp
parent628159323c60c434a202b036ecbaf5e433c703e8 (diff)
parente3bc34b40559e0cb88363039ee61300478e7c700 (diff)
downloadQt-b4b1b118015d1dcef63b065a609234a18f332ba4.zip
Qt-b4b1b118015d1dcef63b065a609234a18f332ba4.tar.gz
Qt-b4b1b118015d1dcef63b065a609234a18f332ba4.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src/declarative/qml/qdeclarativeexpression.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeexpression.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp
index 8ae5f2f..96cdec1 100644
--- a/src/declarative/qml/qdeclarativeexpression.cpp
+++ b/src/declarative/qml/qdeclarativeexpression.cpp
@@ -214,8 +214,30 @@ QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContex
/*!
\class QDeclarativeExpression
- \since 4.7
+ \since 4.7
\brief The QDeclarativeExpression class evaluates JavaScript in a QML context.
+
+ For example, given a file \c main.qml like this:
+
+ \qml
+ import Qt 4.7
+
+ Item {
+ width: 200; height: 200
+ }
+ \endqml
+
+ The following code evaluates a JavaScript expression in the context of the
+ above QML:
+
+ \code
+ QDeclarativeEngine *engine = new QDeclarativeEngine;
+ QDeclarativeComponent component(engine, QUrl::fromLocalFile("main.qml"));
+
+ QObject *myObject = component.create();
+ QDeclarativeExpression *expr = new QDeclarativeExpression(engine->rootContext(), myObject, "width * 2");
+ int result = expr->evaluate().toInt(); // result = 400
+ \endcode
*/
/*!