QAbstractTransition

The QAbstractTransition class is the base class of transitions between QAbstractState objects. More

Inheritance diagram of PySide2.QtCore.QAbstractTransition

Inherited by: QEventTransition, QSignalTransition, QKeyEventTransition, QMouseEventTransition

New in version 4.6.

Synopsis

Functions

Virtual functions

Detailed Description

The QAbstractTransition class is the abstract base class of transitions between states ( QAbstractState objects) of a QStateMachine . QAbstractTransition is part of The State Machine Framework .

The sourceState() function returns the source of the transition. The targetStates() function returns the targets of the transition. The machine() function returns the state machine that the transition is part of.

The triggered() signal is emitted when the transition has been triggered.

Transitions can cause animations to be played. Use the addAnimation() function to add an animation to the transition.

Subclassing

The eventTest() function is called by the state machine to determine whether an event should trigger the transition. In your reimplementation you typically check the event type and cast the event object to the proper type, and check that one or more properties of the event meet your criteria.

The onTransition() function is called when the transition is triggered; reimplement this function to perform custom processing for the transition.

class PySide2.QtCore.QAbstractTransition([sourceState=None])
param sourceState:

PySide2.QtCore.QState

Constructs a new QAbstractTransition object with the given sourceState .

PySide2.QtCore.QAbstractTransition.TransitionType

This enum specifies the kind of transition. By default, the type is an external transition.

Constant

Description

QAbstractTransition.ExternalTransition

Any state that is the source state of a transition (which is not a target-less transition) is left, and re-entered when necessary.

QAbstractTransition.InternalTransition

If the target state of a transition is a sub-state of a compound state, and that compound state is the source state, an internal transition will not leave the source state.

See also

transitionType

New in version 5.5.

PySide2.QtCore.QAbstractTransition.addAnimation(animation)
Parameters:

animationPySide2.QtCore.QAbstractAnimation

Adds the given animation to this transition. The transition does not take ownership of the animation.

PySide2.QtCore.QAbstractTransition.animations()
Return type:

Returns the list of animations associated with this transition, or an empty list if it has no animations.

See also

addAnimation()

PySide2.QtCore.QAbstractTransition.eventTest(event)
Parameters:

eventPySide2.QtCore.QEvent

Return type:

bool

This function is called to determine whether the given event should cause this transition to trigger. Reimplement this function and return true if the event should trigger the transition, otherwise return false.

PySide2.QtCore.QAbstractTransition.machine()
Return type:

PySide2.QtCore.QStateMachine

Returns the state machine that this transition is part of, or None if the transition is not part of a state machine.

PySide2.QtCore.QAbstractTransition.onTransition(event)
Parameters:

eventPySide2.QtCore.QEvent

This function is called when the transition is triggered. The given event is what caused the transition to trigger. Reimplement this function to perform custom processing when the transition is triggered.

PySide2.QtCore.QAbstractTransition.removeAnimation(animation)
Parameters:

animationPySide2.QtCore.QAbstractAnimation

Removes the given animation from this transition.

See also

addAnimation()

PySide2.QtCore.QAbstractTransition.setTargetState(target)
Parameters:

targetPySide2.QtCore.QAbstractState

This property holds the target state of this transition.

If a transition has no target state, the transition may still be triggered, but this will not cause the state machine’s configuration to change (i.e. the current state will not be exited and re-entered).

PySide2.QtCore.QAbstractTransition.setTargetStates(targets)
Parameters:

targets

This property holds the target states of this transition.

If multiple states are specified, all must be descendants of the same parallel group state.

PySide2.QtCore.QAbstractTransition.setTransitionType(type)
Parameters:

typeTransitionType

This property holds indicates whether this transition is an internal transition, or an external transition..

Internal and external transitions behave the same, except for the case of a transition whose source state is a compound state and whose target(s) is a descendant of the source. In such a case, an internal transition will not exit and re-enter its source state, while an external one will.

By default, the type is an external transition.

PySide2.QtCore.QAbstractTransition.sourceState()
Return type:

PySide2.QtCore.QState

This property holds the source state (parent) of this transition.

PySide2.QtCore.QAbstractTransition.targetState()
Return type:

PySide2.QtCore.QAbstractState

This property holds the target state of this transition.

If a transition has no target state, the transition may still be triggered, but this will not cause the state machine’s configuration to change (i.e. the current state will not be exited and re-entered).

PySide2.QtCore.QAbstractTransition.targetStates()
Return type:

This property holds the target states of this transition.

If multiple states are specified, all must be descendants of the same parallel group state.

PySide2.QtCore.QAbstractTransition.transitionType()
Return type:

TransitionType

This property holds indicates whether this transition is an internal transition, or an external transition..

Internal and external transitions behave the same, except for the case of a transition whose source state is a compound state and whose target(s) is a descendant of the source. In such a case, an internal transition will not exit and re-enter its source state, while an external one will.

By default, the type is an external transition.