QQmlScriptString#

The QQmlScriptString class encapsulates a script and its context. More

Inheritance diagram of PySide6.QtQml.QQmlScriptString

Synopsis#

Functions#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

QQmlScriptString 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 QQmlScriptString , 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 QQmlExpression .

QQmlExpression expr(scriptString);
expr.evaluate();

See also

QQmlExpression

class PySide6.QtQml.QQmlScriptString#

PySide6.QtQml.QQmlScriptString(arg__1)

Parameters:

arg__1PySide6.QtQml.QQmlScriptString

Constructs an empty instance.

Copies other.

PySide6.QtQml.QQmlScriptString.QmlIsAnonymous#
PySide6.QtQml.QQmlScriptString.booleanLiteral()#
Return type:

PyTuple

If the content of the QQmlScriptString is a boolean literal, returns the boolean value and sets ok to true. Otherwise returns false and sets ok to false.

PySide6.QtQml.QQmlScriptString.isEmpty()#
Return type:

bool

Returns whether the QQmlScriptString is empty.

PySide6.QtQml.QQmlScriptString.isNullLiteral()#
Return type:

bool

Returns whether the content of the QQmlScriptString is the null literal.

PySide6.QtQml.QQmlScriptString.isUndefinedLiteral()#
Return type:

bool

Returns whether the content of the QQmlScriptString is the undefined literal.

PySide6.QtQml.QQmlScriptString.numberLiteral()#
Return type:

PyTuple

If the content of the QQmlScriptString is a number literal, returns that number and sets ok to true. Otherwise returns 0.0 and sets ok to false.

PySide6.QtQml.QQmlScriptString.__ne__(arg__1)#
Parameters:

arg__1PySide6.QtQml.QQmlScriptString

Return type:

bool

Returns true if this and the other QQmlScriptString objects are different.

See also

operator==()

PySide6.QtQml.QQmlScriptString.__eq__(arg__1)#
Parameters:

arg__1PySide6.QtQml.QQmlScriptString

Return type:

bool

Returns true if this and the other QQmlScriptString objects are equal.

See also

operator!=()

PySide6.QtQml.QQmlScriptString.stringLiteral()#
Return type:

str

If the content of the QQmlScriptString is a string literal, returns that string. Otherwise returns a null QString .