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

    上一话题

    QAbstractState

    下一话题

    QStateMachine

    QState

    继承者: QStateMachine

    注意

    该类在 Qt4.6 引入

    概要

    函数

    详细描述

    PySide.QtCore.QState class provides a general-purpose state for PySide.QtCore.QStateMachine .

    PySide.QtCore.QState objects can have child states, and can have transitions to other states. PySide.QtCore.QState is part of 状态机框架 .

    PySide.QtCore.QState.addTransition() function adds a transition. The PySide.QtCore.QState.removeTransition() function removes a transition. The PySide.QtCore.QState.transitions() function returns the state's outgoing transitions.

    PySide.QtCore.QState.assignProperty() function is used for defining property assignments that should be performed when a state is entered.

    Top-level states must be passed a PySide.QtCore.QStateMachine object as their parent state, or added to a state machine using QStateMachine.addState() .

    States with Child States

    PySide.QtCore.QState.childMode() property determines how child states are treated. For non-parallel state groups, the PySide.QtCore.QState.setInitialState() function must be called to set the initial state. The child states are mutually exclusive states, and the state machine needs to know which child state to enter when the parent state is the target of a transition.

    The state emits the QState.finished() signal when a final child state ( PySide.QtCore.QFinalState ) is entered.

    PySide.QtCore.QState.setErrorState() sets the state's error state. The error state is the state that the state machine will transition to if an error is detected when attempting to enter the state (e.g. because no initial state has been set).

    class PySide.QtCore. QState ( [ parent=None ] )
    class PySide.QtCore. QState ( childMode [ , parent=None ] )
    参数:

    Constructs a new state with the given parent 状态。

    Constructs a new state with the given childMode 和给定 parent 状态。

    PySide.QtCore.QState. ChildMode

    This enum specifies how a state's child states are treated.

    常量 描述
    QState.ExclusiveStates The child states are mutually exclusive and an initial state must be set by calling QState.setInitialState() .
    QState.ParallelStates The child states are parallel. When the parent state is entered, all its child states are entered in parallel.
    PySide.QtCore.QState. addTransition ( sender , signal , target )
    参数:
    返回类型:

    PySide.QtCore.QSignalTransition

    Adds a transition associated with the given signal 为给定 sender object, and returns the new PySide.QtCore.QSignalTransition object. The transition has this state as the source, and the given target as the target state.

    PySide.QtCore.QState. addTransition ( transition )
    参数: transition PySide.QtCore.QAbstractTransition

    添加给定 transition . The transition has this state as the source. This state takes ownership of the transition.

    PySide.QtCore.QState. addTransition ( target )
    参数: target PySide.QtCore.QAbstractState
    返回类型: PySide.QtCore.QAbstractTransition

    Adds an unconditional transition from this state to the given target state, and returns then new transition object.

    PySide.QtCore.QState. addTransition ( arg__1 , arg__2 )
    参数:
    返回类型:

    PySide.QtCore.QSignalTransition

    PySide.QtCore.QState. assignProperty ( object , name , value )
    参数:

    Instructs this state to set the property with the given name 为给定 object 到给定 value when the state is entered.

    PySide.QtCore.QState. childMode ( )
    返回类型: PySide.QtCore.QState.ChildMode

    This property holds the child mode of this state.

    此特性的默认值为 QState.ExclusiveStates .

    PySide.QtCore.QState. errorState ( )
    返回类型: PySide.QtCore.QAbstractState

    This property holds the error state of this state.

    PySide.QtCore.QState. finished ( )
    PySide.QtCore.QState. initialState ( )
    返回类型: PySide.QtCore.QAbstractState

    This property holds the initial state of this state (one of its child states).

    PySide.QtCore.QState. propertiesAssigned ( )
    PySide.QtCore.QState. removeTransition ( transition )
    参数: transition PySide.QtCore.QAbstractTransition

    移除给定 transition from this state. The state releases ownership of the transition.

    PySide.QtCore.QState. setChildMode ( mode )
    参数: mode PySide.QtCore.QState.ChildMode

    This property holds the child mode of this state.

    此特性的默认值为 QState.ExclusiveStates .

    PySide.QtCore.QState. setErrorState ( state )
    参数: state PySide.QtCore.QAbstractState

    This property holds the error state of this state.

    PySide.QtCore.QState. setInitialState ( state )
    参数: state PySide.QtCore.QAbstractState

    This property holds the initial state of this state (one of its child states).

    PySide.QtCore.QState. 过渡 ( )
    返回类型:

    Returns this state's outgoing transitions (i.e. transitions where this state is the source state ), or an empty list if this state has no outgoing transitions.