• PySide 模块
  • PySide.QtDeclarative
  • 内容表表

    上一话题

    PySide.QtDeclarative

    下一话题

    QDeclarativeProperty

    QDeclarativeScriptString

    概要

    函数

    详细描述

    PySide.QtDeclarative.QDeclarativeScriptString class encapsulates a script and its context.

    PySide.QtDeclarative.QDeclarativeScriptString is used to create PySide.QtCore.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)

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

    If instead the property had a type of PySide.QtDeclarative.QDeclarativeScriptString , 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 PySide.QtDeclarative.QDeclarativeExpression .

    QDeclarativeExpression expr(scriptString.context(), scriptString.script(), scriptStr.scopeObject());
    expr.value();
    									
    class PySide.QtDeclarative. QDeclarativeScriptString
    class PySide.QtDeclarative. QDeclarativeScriptString ( arg__1 )
    参数: arg__1 PySide.QtDeclarative.QDeclarativeScriptString

    Constructs an empty instance.

    Copies other .

    PySide.QtDeclarative.QDeclarativeScriptString. context ( )
    返回类型: PySide.QtDeclarative.QDeclarativeContext

    Returns the context for the script.

    PySide.QtDeclarative.QDeclarativeScriptString. scopeObject ( )
    返回类型: PySide.QtCore.QObject

    Returns the scope object for the script.

    PySide.QtDeclarative.QDeclarativeScriptString. script ( )
    返回类型: unicode

    Returns the script text.

    PySide.QtDeclarative.QDeclarativeScriptString. setContext ( arg__1 )
    参数: arg__1 PySide.QtDeclarative.QDeclarativeContext

    设置 context for the script.

    PySide.QtDeclarative.QDeclarativeScriptString. setScopeObject ( arg__1 )
    参数: arg__1 PySide.QtCore.QObject

    Sets the scope object for the script.

    PySide.QtDeclarative.QDeclarativeScriptString. setScript ( arg__1 )
    参数: arg__1 – unicode

    设置 script text.