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

    上一话题

    QMetaProperty

    下一话题

    QBasicTimer

    QMetaEnum

    概要

    函数

    详细描述

    PySide.QtCore.QMetaEnum class provides meta-data about an enumerator.

    使用 PySide.QtCore.QMetaEnum.name() for the enumerator's name. The enumerator's keys (names of each enumerated item) are returned by PySide.QtCore.QMetaEnum.key() ; use PySide.QtCore.QMetaEnum.keyCount() to find the number of keys. PySide.QtCore.QMetaEnum.isFlag() returns whether the enumerator is meant to be used as a flag, meaning that its values can be combined using the OR operator.

    The conversion functions PySide.QtCore.QMetaEnum.keyToValue() , PySide.QtCore.QMetaEnum.valueToKey() , PySide.QtCore.QMetaEnum.keysToValue() ,和 PySide.QtCore.QMetaEnum.valueToKeys() allow conversion between the integer representation of an enumeration or set value and its literal representation. The PySide.QtCore.QMetaEnum.scope() function returns the class scope this enumerator was declared in.

    class PySide.QtCore. QMetaEnum
    class PySide.QtCore. QMetaEnum ( QMetaEnum )
    参数: QMetaEnum PySide.QtCore.QMetaEnum
    PySide.QtCore.QMetaEnum. isFlag ( )
    返回类型: PySide.QtCore.bool

    Returns true if this enumerator is used as a flag; otherwise returns false.

    When used as flags, enumerators can be combined using the OR operator.

    PySide.QtCore.QMetaEnum. isValid ( )
    返回类型: PySide.QtCore.bool

    Returns true if this enum is valid (has a name); otherwise returns false.

    PySide.QtCore.QMetaEnum. key ( index )
    参数: index PySide.QtCore.int
    返回类型: str

    Returns the key with the given index , or 0 if no such key exists.

    PySide.QtCore.QMetaEnum. keyCount ( )
    返回类型: PySide.QtCore.int

    返回键数。

    PySide.QtCore.QMetaEnum. keyToValue ( key )
    参数: key – str
    返回类型: PySide.QtCore.int

    Returns the integer value of the given enumeration key , or -1 if key is not defined.

    For flag types, use PySide.QtCore.QMetaEnum.keysToValue() .

    PySide.QtCore.QMetaEnum. keysToValue ( keys )
    参数: keys – str
    返回类型: PySide.QtCore.int

    Returns the value derived from combining together the values of the keys using the OR operator, or -1 if keys is not defined. Note that the strings in keys must be ‘|'-separated.

    PySide.QtCore.QMetaEnum. name ( )
    返回类型: str

    Returns the name of the enumerator (without the scope).

    例如, Qt.AlignmentFlag enumeration has AlignmentFlag as the name and Qt as the scope.

    PySide.QtCore.QMetaEnum. scope ( )
    返回类型: str

    Returns the scope this enumerator was declared in.

    例如, Qt.AlignmentFlag enumeration has Qt as the scope and AlignmentFlag as the name.

    PySide.QtCore.QMetaEnum. value ( index )
    参数: index PySide.QtCore.int
    返回类型: PySide.QtCore.int

    Returns the value with the given index ; or returns -1 if there is no such value.

    PySide.QtCore.QMetaEnum. valueToKey ( value )
    参数: value PySide.QtCore.int
    返回类型: str

    Returns the string that is used as the name of the given enumeration value , or 0 if value is not defined.

    For flag types, use PySide.QtCore.QMetaEnum.valueToKeys() .

    PySide.QtCore.QMetaEnum. valueToKeys ( value )
    参数: value PySide.QtCore.int
    返回类型: PySide.QtCore.QByteArray

    Returns a byte array of ‘|'-separated keys that represents the given value .