Qt 4.8
|
The QDeclarativeScriptString class encapsulates a script and its context. More...
#include <qdeclarativescriptstring.h>
Public Functions | |
QDeclarativeContext * | context () const |
Returns the context for the script. More... | |
QDeclarativeScriptString & | operator= (const QDeclarativeScriptString &) |
Assigns other to this. More... | |
QDeclarativeScriptString () | |
Constructs an empty instance. More... | |
QDeclarativeScriptString (const QDeclarativeScriptString &) | |
Copies other. More... | |
QObject * | scopeObject () const |
Returns the scope object for the script. More... | |
QString | script () const |
Returns the script text. More... | |
void | setContext (QDeclarativeContext *) |
Sets the context for the script. More... | |
void | setScopeObject (QObject *) |
Sets the scope object for the script. More... | |
void | setScript (const QString &) |
Sets the script text. More... | |
~QDeclarativeScriptString () | |
Properties | |
QSharedDataPointer< QDeclarativeScriptStringPrivate > | d |
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)}
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.
Definition at line 58 of file qdeclarativescriptstring.h.
QDeclarativeScriptString::QDeclarativeScriptString | ( | ) |
Constructs an empty instance.
Definition at line 91 of file qdeclarativescriptstring.cpp.
QDeclarativeScriptString::QDeclarativeScriptString | ( | const QDeclarativeScriptString & | other | ) |
Copies other.
Definition at line 99 of file qdeclarativescriptstring.cpp.
QDeclarativeScriptString::~QDeclarativeScriptString | ( | ) |
Definition at line 107 of file qdeclarativescriptstring.cpp.
QDeclarativeContext * QDeclarativeScriptString::context | ( | ) | const |
Returns the context for the script.
Definition at line 123 of file qdeclarativescriptstring.cpp.
Referenced by QDeclarativeScriptActionPrivate::execute(), and setContext().
QDeclarativeScriptString & QDeclarativeScriptString::operator= | ( | const QDeclarativeScriptString & | other | ) |
Assigns other to this.
Definition at line 114 of file qdeclarativescriptstring.cpp.
QObject * QDeclarativeScriptString::scopeObject | ( | ) | const |
Returns the scope object for the script.
Definition at line 139 of file qdeclarativescriptstring.cpp.
Referenced by QDeclarativeScriptActionPrivate::execute().
QString QDeclarativeScriptString::script | ( | ) | const |
Returns the script text.
Definition at line 155 of file qdeclarativescriptstring.cpp.
Referenced by QDeclarativeScriptActionPrivate::execute(), QDeclarativeAnchorSet::setBaseline(), QDeclarativeAnchorSet::setBottom(), QDeclarativeParentChange::setHeight(), QDeclarativeAnchorSet::setHorizontalCenter(), QDeclarativeAnchorSet::setLeft(), QDeclarativeAnchorSet::setRight(), QDeclarativeParentChange::setRotation(), QDeclarativeParentChange::setScale(), setScript(), QDeclarativeAnchorSet::setTop(), QDeclarativeAnchorSet::setVerticalCenter(), QDeclarativeParentChange::setWidth(), QDeclarativeParentChange::setX(), and QDeclarativeParentChange::setY().
void QDeclarativeScriptString::setContext | ( | QDeclarativeContext * | context | ) |
Sets the context for the script.
Definition at line 131 of file qdeclarativescriptstring.cpp.
void QDeclarativeScriptString::setScopeObject | ( | QObject * | object | ) |
Sets the scope object for the script.
Definition at line 147 of file qdeclarativescriptstring.cpp.
void QDeclarativeScriptString::setScript | ( | const QString & | script | ) |
Sets the script text.
Definition at line 163 of file qdeclarativescriptstring.cpp.
|
private |
Definition at line 77 of file qdeclarativescriptstring.h.
Referenced by context(), operator=(), scopeObject(), script(), setContext(), setScopeObject(), and setScript().