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 QAbstractTransition([sourceState=None])
param sourceState

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

animationQAbstractAnimation

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

eventQEvent

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

QStateMachine

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

PySide2.QtCore.QAbstractTransition.onTransition(event)
Parameters

eventQEvent

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

animationQAbstractAnimation

Removes the given animation from this transition.

See also

addAnimation()

PySide2.QtCore.QAbstractTransition.setTargetState(target)
Parameters

targetQAbstractState

Sets the target state of this transition.

See also

targetState()

PySide2.QtCore.QAbstractTransition.setTargetStates(targets)
Parameters

targets

Sets the target states of this transition to be the given targets .

See also

targetStates()

PySide2.QtCore.QAbstractTransition.setTransitionType(type)
Parameters

typeTransitionType

Sets the type of the transition to type .

See also

transitionType()

PySide2.QtCore.QAbstractTransition.sourceState()
Return type

QState

Returns the source state of this transition, or 0 if this transition has no source state.

PySide2.QtCore.QAbstractTransition.targetState()
Return type

QAbstractState

Returns the target state of this transition, or 0 if the transition has no target.

See also

setTargetState()

PySide2.QtCore.QAbstractTransition.targetStates()
Return type

Returns the target states of this transition, or an empty list if this transition has no target states.

PySide2.QtCore.QAbstractTransition.transitionType()
Return type

TransitionType

Returns the type of the transition.