内容表

上一话题

QQmlPropertyValueSource

下一话题

QQmlTypesExtensionInterface

QQmlScriptString

QQmlScriptString class encapsulates a script and its context. 更多

Inheritance diagram of PySide2.QtQml.QQmlScriptString

详细描述

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();
											

另请参阅

QQmlExpression

class QQmlScriptString

QQmlScriptString(arg__1)

param arg__1

QQmlScriptString

Constructs an empty instance.

拷贝 other .

PySide2.QtQml.QQmlScriptString. booleanLiteral ( )
返回类型

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 为 false。

PySide2.QtQml.QQmlScriptString. isEmpty ( )
返回类型

bool

Returns whether the QQmlScriptString is empty.

PySide2.QtQml.QQmlScriptString. isNullLiteral ( )
返回类型

bool

Returns whether the content of the QQmlScriptString null literal.

PySide2.QtQml.QQmlScriptString. isUndefinedLiteral ( )
返回类型

bool

Returns whether the content of the QQmlScriptString undefined literal.

PySide2.QtQml.QQmlScriptString. numberLiteral ( )
返回类型

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 为 false。

PySide2.QtQml.QQmlScriptString. __ne__ ( arg__1 )
参数

arg__1 QQmlScriptString

返回类型

bool

返回 true 若此和 other QQmlScriptString objects are different.

另请参阅

operator==()

PySide2.QtQml.QQmlScriptString. __eq__ ( arg__1 )
参数

arg__1 QQmlScriptString

返回类型

bool

返回 true 若此和 other QQmlScriptString 对象是相等的。

另请参阅

operator!=()

PySide2.QtQml.QQmlScriptString. stringLiteral ( )
返回类型

unicode

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