QAbstractTransition¶
The
QAbstractTransition
class is the base class of transitions betweenQAbstractState
objects. More…
Inherited by: QEventTransition, QSignalTransition, QKeyEventTransition, QMouseEventTransition
New in version 4.6.
Synopsis¶
Functions¶
def
addAnimation
(animation)def
animations
()def
machine
()def
removeAnimation
(animation)def
setTargetState
(target)def
setTargetStates
(targets)def
setTransitionType
(type)def
sourceState
()def
targetState
()def
targetStates
()def
transitionType
()
Virtual functions¶
def
eventTest
(event)def
onTransition
(event)
Detailed Description¶
The
QAbstractTransition
class is the abstract base class of transitions between states (QAbstractState
objects) of aQStateMachine
.QAbstractTransition
is part of The 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 PySide2.QtCore.QAbstractTransition([sourceState=None])¶
- param sourceState:
Constructs a new
QAbstractTransition
object with the givensourceState
.
- 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
New in version 5.5.
- PySide2.QtCore.QAbstractTransition.addAnimation(animation)¶
- Parameters:
animation –
PySide2.QtCore.QAbstractAnimation
Adds the given
animation
to this transition. The transition does not take ownership of the animation.See also
- 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
- PySide2.QtCore.QAbstractTransition.eventTest(event)¶
- Parameters:
event –
PySide2.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:
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:
event –
PySide2.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:
animation –
PySide2.QtCore.QAbstractAnimation
Removes the given
animation
from this transition.See also
- PySide2.QtCore.QAbstractTransition.setTargetState(target)¶
- Parameters:
target –
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.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:
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.
- PySide2.QtCore.QAbstractTransition.sourceState()¶
- Return type:
This property holds the source state (parent) of this transition.
- PySide2.QtCore.QAbstractTransition.targetState()¶
- Return type:
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:
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.
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.