The QDeclarativeScriptString class encapsulates a script and its context. More...
#include <QDeclarativeScriptString>
This class was introduced in Qt 4.7.
QDeclarativeScriptString () | |
QDeclarativeScriptString ( const QDeclarativeScriptString & other ) | |
QDeclarativeContext * | context () const |
QObject * | scopeObject () const |
QString | script () const |
void | setContext ( QDeclarativeContext * context ) |
void | setScopeObject ( QObject * object ) |
void | setScript ( const QString & script ) |
QDeclarativeScriptString & | operator= ( const QDeclarativeScriptString & other ) |
The QDeclarativeScriptString class encapsulates a script and its context.
QDeclarativeScriptString is used to create QObject properties that accept a script "assignment" from QML.
Normally, the following QML would result in a binding being established for the script property; i.e. script would be assigned the value obtained from running myObj.value = Math.max(myValue, 100)
MyType { script: myObj.value = Math.max(myValue, 100) }
If instead the property had a type of QDeclarativeScriptString, the script itself -- myObj.value = Math.max(myValue, 100) -- would be passed to the 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.
QDeclarativeExpression expr(scriptString.context(), scriptString.script(), scriptStr.scopeObject()); expr.value();
See also QDeclarativeExpression.
Constructs an empty instance.
Copies other.
Returns the context for the script.
See also setContext().
Returns the scope object for the script.
See also setScopeObject().
Returns the script text.
See also setScript().
Sets the context for the script.
See also context().
Sets the scope object for the script.
See also scopeObject().
Sets the script text.
See also script().
Assigns other to this.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.