PySide6.QtQml.QQmlScriptString¶
- class QQmlScriptString¶
The
QQmlScriptStringclass encapsulates a script and its context. More…Synopsis¶
Methods¶
def
__init__()def
booleanLiteral()def
isEmpty()def
isNullLiteral()def
numberLiteral()def
__ne__()def
__eq__()def
stringLiteral()
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¶
QQmlScriptStringis 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
scriptproperty; i.e.scriptwould be assigned the value obtained from runningmyObj.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 thescriptproperty and the class could choose how to handle it. Typically, the class will evaluate the script at some later time using aQQmlExpression.QQmlExpression expr(scriptString); expr.evaluate();
See also
- __init__()¶
Constructs an empty instance.
- __init__(other)
- Parameters:
other –
QQmlScriptString
Copies
other.- booleanLiteral()¶
- Return type:
PyTuple
If the content of the
QQmlScriptStringis a boolean literal, returns the boolean value and setsokto true. Otherwise returns false and setsokto false.- isEmpty()¶
- Return type:
bool
Returns whether the
QQmlScriptStringis empty.- isNullLiteral()¶
- Return type:
bool
Returns whether the content of the
QQmlScriptStringis thenullliteral.- isUndefinedLiteral()¶
- Return type:
bool
Returns whether the content of the
QQmlScriptStringis theundefinedliteral.- numberLiteral()¶
- Return type:
PyTuple
If the content of the
QQmlScriptStringis a number literal, returns that number and setsokto true. Otherwise returns 0.0 and setsokto false.- __ne__(other)¶
- Parameters:
other –
QQmlScriptString- Return type:
bool
Returns
trueif this and theotherQQmlScriptStringobjects are different.See also
operator==()- __eq__(other)¶
- Parameters:
other –
QQmlScriptString- Return type:
bool
Returns
trueif this and theotherQQmlScriptStringobjects are equal.See also
operator!=()- stringLiteral()¶
- Return type:
str
If the content of the
QQmlScriptStringis a string literal, returns that string. Otherwise returns a null QString.