PySide6.QtStateMachine.QAbstractTransition¶
- class QAbstractTransition¶
The
QAbstractTransition
class is the base class of transitions between QAbstractState objects. More…Inherited by:
QSignalTransition
,QEventTransition
,QMouseEventTransition
,QKeyEventTransition
Synopsis¶
Properties¶
sourceStateᅟ
- The source state (parent) of this transitiontargetStateᅟ
- The target state of this transitiontargetStatesᅟ
- The target states of this transitiontransitionTypeᅟ
- Indicates whether this transition is an internal transition, or an external transition
Methods¶
def
__init__()
def
addAnimation()
def
animations()
def
machine()
def
setTargetState()
def
sourceState()
def
targetState()
def
targetStates()
def
transitionType()
Virtual methods¶
def
eventTest()
def
onTransition()
Signals¶
def
triggered()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
The
QAbstractTransition
class is the abstract base class of transitions between states ( QAbstractState objects) of aQStateMachine
.QAbstractTransition
is part of Qt State Machine Framework .The
sourceState()
function returns the source of the transition. ThetargetStates()
function returns the targets of the transition. Themachine()
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 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
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.This property holds the source state (parent) of this transition.
- Access functions:
- property targetStateᅟ: 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).
- Access functions:
- property targetStatesᅟ: list of QAbstractState¶
This property holds the target states of this transition.
If multiple states are specified, all must be descendants of the same parallel group state.
- Access functions:
- property transitionTypeᅟ: QAbstractTransition.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.
- Access functions:
Constructs a new
QAbstractTransition
object with the givensourceState
.- addAnimation(animation)¶
- Parameters:
animation –
QAbstractAnimation
Adds the given
animation
to this transition. The transition does not take ownership of the animation.See also
- animations()¶
- Return type:
.list of QAbstractAnimation
Returns the list of animations associated with this transition, or an empty list if it has no animations.
See also
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.- machine()¶
- Return type:
Returns the state machine that this transition is part of, or
None
if the transition is not part of a state machine.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.- removeAnimation(animation)¶
- Parameters:
animation –
QAbstractAnimation
Removes the given
animation
from this transition.See also
- setTargetState(target)¶
- Parameters:
target –
QAbstractState
Sets the
target
state of this transition.See also
Setter of property
targetStateᅟ
.- setTargetStates(targets)¶
- Parameters:
targets – .list of QAbstractState
Sets the target states of this transition to be the given
targets
.See also
Setter of property
targetStatesᅟ
.- setTransitionType(type)¶
- Parameters:
type –
TransitionType
Sets the type of the transition to
type
.See also
Setter of property
transitionTypeᅟ
.Returns the source state of this transition, or
None
if this transition has no source state.Getter of property
sourceStateᅟ
.- targetState()¶
- Return type:
Returns the target state of this transition, or
None
if the transition has no target.See also
Getter of property
targetStateᅟ
.- targetStateChanged()¶
This signal is emitted when the
targetState
property is changed.See also
Notification signal of property
targetStateᅟ
.- targetStates()¶
- Return type:
.list of QAbstractState
Returns the target states of this transition, or an empty list if this transition has no target states.
See also
Getter of property
targetStatesᅟ
.- targetStatesChanged()¶
This signal is emitted when the
targetStates
property is changed.See also
Notification signal of property
targetStatesᅟ
.- transitionType()¶
- Return type:
Returns the type of the transition.
See also
Getter of property
transitionTypeᅟ
.- triggered()¶
This signal is emitted when the transition has been triggered (after
onTransition()
has been called).