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

    上一话题

    QScriptString

    下一话题

    QScriptContext

    QScriptContextInfo

    详细描述

    PySide.QtScript.QScriptContextInfo class provides additional information about a PySide.QtScript.QScriptContext .

    PySide.QtScript.QScriptContextInfo is typically used for debugging purposes. It can provide information about the code being executed, such as the type of the called function, and the original source code location of the current statement.

    If the called function is executing Qt Script code, you can obtain the script location with the functions PySide.QtScript.QScriptContextInfo.fileName() and PySide.QtScript.QScriptContextInfo.lineNumber() .

    You can obtain the starting line number and ending line number of a Qt Script function definition with PySide.QtScript.QScriptContextInfo.functionStartLineNumber() and PySide.QtScript.QScriptContextInfo.functionEndLineNumber() , respectively.

    For Qt Script functions and Qt methods (e.g. slots), you can call PySide.QtScript.QScriptContextInfo.functionParameterNames() to get the names of the formal parameters of the function.

    For Qt methods and Qt property accessors, you can obtain the index of the underlying PySide.QtCore.QMetaMethod or PySide.QtCore.QMetaProperty 通过调用 PySide.QtScript.QScriptContextInfo.functionMetaIndex() .

    另请参阅

    PySide.QtScript.QScriptContext PySide.QtScript.QScriptEngineAgent

    class PySide.QtScript. QScriptContextInfo
    class PySide.QtScript. QScriptContextInfo ( context )
    class PySide.QtScript. QScriptContextInfo ( other )
    参数:

    Constructs a null PySide.QtScript.QScriptContextInfo .

    构造新 PySide.QtScript.QScriptContextInfo from the given context .

    The relevant information is extracted from the context at construction time; i.e. if you continue script execution in the context , the new state of the context will not be reflected in a previously created PySide.QtScript.QScriptContextInfo .

    构造新 PySide.QtScript.QScriptContextInfo other info.

    PySide.QtScript.QScriptContextInfo. FunctionType

    This enum specifies the type of function being called.

    常量 描述
    QScriptContextInfo.ScriptFunction The function is a Qt Script function, i.e. it was defined through a call to QScriptEngine.evaluate() .
    QScriptContextInfo.QtFunction The function is a Qt function (a signal, slot or method).
    QScriptContextInfo.QtPropertyFunction The function is a Qt property getter or setter.
    QScriptContextInfo.NativeFunction The function is a built-in Qt Script function, or it was defined through a call to QScriptEngine.newFunction() .
    PySide.QtScript.QScriptContextInfo. columnNumber ( )
    返回类型: PySide.QtCore.int
    PySide.QtScript.QScriptContextInfo. fileName ( )
    返回类型: unicode

    Returns the name of the file where the code being executed was defined, if available; otherwise returns an empty string.

    For Qt Script code, this function returns the fileName argument that was passed to QScriptEngine.evaluate() .

    PySide.QtScript.QScriptContextInfo. functionEndLineNumber ( )
    返回类型: PySide.QtCore.int

    Returns the line number where the definition of the called function ends, or -1 if the line number is not available.

    The ending line number is only available if the PySide.QtScript.QScriptContextInfo.functionType() is ScriptFunction .

    PySide.QtScript.QScriptContextInfo. functionMetaIndex ( )
    返回类型: PySide.QtCore.int

    Returns the meta index of the called function, or -1 if the meta index is not available.

    The meta index is only available if the PySide.QtScript.QScriptContextInfo.functionType() is QtFunction or QtPropertyFunction . For QtFunction , the meta index can be passed to QMetaObject.method() to obtain the corresponding method definition; for QtPropertyFunction , the meta index can be passed to QMetaObject.property() to obtain the corresponding property definition.

    PySide.QtScript.QScriptContextInfo. functionName ( )
    返回类型: unicode

    Returns the name of the called function, or an empty string if the name is not available.

    For script functions of type QtPropertyFunction , this function always returns the name of the property; you can use QScriptContext.argumentCount() to differentiate between reads and writes.

    PySide.QtScript.QScriptContextInfo. functionParameterNames ( )
    返回类型: list of strings

    Returns the names of the formal parameters of the called function, or an empty PySide.QtCore.QStringList if the parameter names are not available.

    PySide.QtScript.QScriptContextInfo. functionStartLineNumber ( )
    返回类型: PySide.QtCore.int

    Returns the line number where the definition of the called function starts, or -1 if the line number is not available.

    The starting line number is only available if the PySide.QtScript.QScriptContextInfo.functionType() is ScriptFunction .

    PySide.QtScript.QScriptContextInfo. functionType ( )
    返回类型: PySide.QtScript.QScriptContextInfo.FunctionType

    Returns the type of the called function.

    PySide.QtScript.QScriptContextInfo. isNull ( )
    返回类型: PySide.QtCore.bool

    返回 true,若此 PySide.QtScript.QScriptContextInfo is null, i.e. does not contain any information.

    PySide.QtScript.QScriptContextInfo. lineNumber ( )
    返回类型: PySide.QtCore.int

    Returns the line number corresponding to the statement being executed, or -1 if the line number is not available.

    The line number is only available if Qt Script code is being executed.

    PySide.QtScript.QScriptContextInfo. __ne__ ( other )
    参数: other PySide.QtScript.QScriptContextInfo
    返回类型: PySide.QtCore.bool

    返回 true,若此 PySide.QtScript.QScriptContextInfo is not equal to the other info, otherwise returns false.

    PySide.QtScript.QScriptContextInfo. __eq__ ( other )
    参数: other PySide.QtScript.QScriptContextInfo
    返回类型: PySide.QtCore.bool

    返回 true,若此 PySide.QtScript.QScriptContextInfo is equal to the other info, otherwise returns false.

    PySide.QtScript.QScriptContextInfo. scriptId ( )
    返回类型: PySide.QtCore.qint64

    Returns the ID of the script where the code being executed was defined, or -1 if the ID is not available (i.e. a native function is being executed).