Home · All Classes · All Functions · Overviews

QDeclarativeScriptString Class Reference
[QtDeclarative module]

The QDeclarativeScriptString class encapsulates a script and its context. More...

 #include <QDeclarativeScriptString>

This class was introduced in Qt 4.7.


Public Functions

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 )

Detailed Description

The QDeclarativeScriptString class encapsulates a script and its context.

The QDeclarativeScriptString is used by properties that want to accept a script "assignment" from QML.

Normally, the following code would result in a binding being established for the script property. If the property had a type of QDeclarativeScriptString, the script - console.log(1921) - itself would be passed to the property and it could choose how to handle it.

 MyType {
     script: console.log(1921)
 }

Member Function Documentation

QDeclarativeScriptString::QDeclarativeScriptString ()

Construct an empty instance.

QDeclarativeScriptString::QDeclarativeScriptString ( const QDeclarativeScriptString & other )

Copy other.

QDeclarativeContext * QDeclarativeScriptString::context () const

Return the context for the script.

See also setContext().

QObject * QDeclarativeScriptString::scopeObject () const

Returns the scope object for the script.

See also setScopeObject().

QString QDeclarativeScriptString::script () const

Returns the script text.

See also setScript().

void QDeclarativeScriptString::setContext ( QDeclarativeContext * context )

Sets the context for the script.

See also context().

void QDeclarativeScriptString::setScopeObject ( QObject * object )

Sets the scope object for the script.

See also scopeObject().

void QDeclarativeScriptString::setScript ( const QString & script )

Sets the script text.

See also script().

QDeclarativeScriptString & QDeclarativeScriptString::operator= ( const QDeclarativeScriptString & other )

Assign other to this.


Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt 4.7.0