Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QDeclarativeScriptString Class

TheQDeclarativeScriptString class encapsulates a script and its context.More...

Header:#include <QDeclarativeScriptString>
Since: Qt 4.7

Public Functions

QDeclarativeScriptString()
QDeclarativeScriptString(const QDeclarativeScriptString & other)
QDeclarativeContext *context() const
QObject *scopeObject() const
QStringscript() const
voidsetContext(QDeclarativeContext * context)
voidsetScopeObject(QObject * object)
voidsetScript(const QString & script)
QDeclarativeScriptString &operator=(const QDeclarativeScriptString & other)

Detailed Description

TheQDeclarativeScriptString class encapsulates a script and its context.

QDeclarativeScriptString is used to createQObject properties that accept a script "assignment" from QML.

Normally, the following QML would result in a binding being established for thescript property; i.e.script would be assigned the value obtained from runningmyObj.value = Math.max(myValue, 100)

MyType {script:myObj.value=Math.max(myValue,100)}

If instead the property had a type ofQDeclarativeScriptString, the script itself --myObj.value = Math.max(myValue, 100) -- would be passed to thescript property and the class could choose how to handle it. Typically, the class will evaluate the script at some later time using aQDeclarativeExpression.

QDeclarativeExpression expr(scriptString.context(), scriptString.script(), scriptStr.scopeObject());expr.value();

See alsoQDeclarativeExpression.

Member Function Documentation

QDeclarativeScriptString::QDeclarativeScriptString()

Constructs an empty instance.

QDeclarativeScriptString::QDeclarativeScriptString(constQDeclarativeScriptString & other)

Copiesother.

QDeclarativeContext * QDeclarativeScriptString::context() const

Returns the context for the script.

See alsosetContext().

QObject * QDeclarativeScriptString::scopeObject() const

Returns the scope object for the script.

See alsosetScopeObject().

QString QDeclarativeScriptString::script() const

Returns the script text.

See alsosetScript().

void QDeclarativeScriptString::setContext(QDeclarativeContext * context)

Sets thecontext for the script.

See alsocontext().

void QDeclarativeScriptString::setScopeObject(QObject * object)

Sets the scopeobject for the script.

See alsoscopeObject().

void QDeclarativeScriptString::setScript(constQString & script)

Sets thescript text.

See alsoscript().

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

Assignsother to this.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp