diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-18 11:22:31 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-18 11:22:31 (GMT) |
commit | 465f4df8ad4be9485c37ecc379c45e758b2842ad (patch) | |
tree | 5067e1a64edb496c76e699d2e2b295a9d7aad784 /src/declarative/qml/qdeclarativescriptstring.cpp | |
parent | 0cea0e45523283d6c31998672f97b0343c1388f2 (diff) | |
parent | e66fcc2b1897883d8ec0780c731c5989cb657cdf (diff) | |
download | Qt-465f4df8ad4be9485c37ecc379c45e758b2842ad.zip Qt-465f4df8ad4be9485c37ecc379c45e758b2842ad.tar.gz Qt-465f4df8ad4be9485c37ecc379c45e758b2842ad.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (29 commits)
Recognize identifiers containing unicode escape sequences.
Fix README
Fix doc: QML_DECLARE_TYPE is no longer necessary
Fix doc: remote contents requires qmldir
Fixed parsing of inner labelled statements.
Doc
Remove unsupported plugin version flags in .pro files of declarative examples
Documentation typo.
More QML doc consistency.
Ensure existing image is gone before next photo selection.
Don't use zoomfactor.
Doc: in QML use "real" and "enumeration", not "qreal" and "enum"
Doc: Put "default" property label on same line as property name
Wait for debug clients asynchronously instead of blocking creation of
Test not reliable
ResizeMode support for QGraphicsWidgets created with QDeclarativeView
More class documentation fixes for declarative.
Simplify QML import plugin deployment lines
Add QML imports to s60installs.pro
Cleanup photoviewer demo.
...
Diffstat (limited to 'src/declarative/qml/qdeclarativescriptstring.cpp')
-rw-r--r-- | src/declarative/qml/qdeclarativescriptstring.cpp | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/declarative/qml/qdeclarativescriptstring.cpp b/src/declarative/qml/qdeclarativescriptstring.cpp index 5b9afe9..8f717d1 100644 --- a/src/declarative/qml/qdeclarativescriptstring.cpp +++ b/src/declarative/qml/qdeclarativescriptstring.cpp @@ -55,24 +55,35 @@ public: /*! \class QDeclarativeScriptString - \since 4.7 +\since 4.7 \brief The QDeclarativeScriptString class encapsulates a script and its context. -The QDeclarativeScriptString is used by properties that want to accept a script "assignment" from QML. +QDeclarativeScriptString is used to create QObject properties that accept a script "assignment" from QML. -Normally, the following code would result in a binding being established for the \c script -property. If the property had a type of QDeclarativeScriptString, the script - \e {console.log(1921)} - itself -would be passed to the property and it could choose how to handle it. +Normally, the following QML would result in a binding being established for the \c script +property; i.e. \c script would be assigned the value obtained from running \c {myObj.value = Math.max(myValue, 100)} -\code +\qml MyType { - script: console.log(1921) + script: myObj.value = Math.max(myValue, 100) } +\endqml + +If instead the property had a type of QDeclarativeScriptString, +the script itself -- \e {myObj.value = Math.max(myValue, 100)} -- would be passed to the \c script property +and the class could choose how to handle it. Typically, the class will evaluate +the script at some later time using a QDeclarativeExpression. + +\code +QDeclarativeExpression expr(scriptString.context(), scriptString.script(), scriptStr.scopeObject()); +expr.value(); \endcode + +\sa QDeclarativeExpression */ /*! -Construct an empty instance. +Constructs an empty instance. */ QDeclarativeScriptString::QDeclarativeScriptString() : d(new QDeclarativeScriptStringPrivate) @@ -80,7 +91,7 @@ QDeclarativeScriptString::QDeclarativeScriptString() } /*! -Copy \a other. +Copies \a other. */ QDeclarativeScriptString::QDeclarativeScriptString(const QDeclarativeScriptString &other) : d(other.d) @@ -95,7 +106,7 @@ QDeclarativeScriptString::~QDeclarativeScriptString() } /*! -Assign \a other to this. +Assigns \a other to this. */ QDeclarativeScriptString &QDeclarativeScriptString::operator=(const QDeclarativeScriptString &other) { @@ -104,7 +115,7 @@ QDeclarativeScriptString &QDeclarativeScriptString::operator=(const QDeclarative } /*! -Return the context for the script. +Returns the context for the script. */ QDeclarativeContext *QDeclarativeScriptString::context() const { |