|  | Home · All Classes · Modules

# QAbstractTransition Class Reference
[QtCore module]

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

Inherits QObject.

Inherited by QEventTransition and QSignalTransition.

### Methods

- __init__ (self, QState sourceState = None)
- addAnimation (self, QAbstractAnimation)
- list-of-QAbstractAnimation animations (self)
- bool event (self, QEvent)
- bool eventTest (self, QEvent)
- QStateMachine machine (self)
- onTransition (self, QEvent)
- removeAnimation (self, QAbstractAnimation)
- setTargetState (self, QAbstractState)
- setTargetStates (self, list-of-QAbstractState)
- QState sourceState (self)
- QAbstractState targetState (self)
- list-of-QAbstractState targetStates (self)

### Qt Signals

- void triggered ()

## Detailed Description

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

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.

## Method Documentation

### QAbstractTransition.__init__ (self, QState sourceState = None)

Constructs a new QAbstractTransition object with the given sourceState.

### QAbstractTransition.addAnimation (self, QAbstractAnimation)

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

See also removeAnimation() and animations().

### list-of-QAbstractAnimation QAbstractTransition.animations (self)

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

See also addAnimation().

### bool QAbstractTransition.event (self, QEvent)

Reimplemented from QObject.event().

### bool QAbstractTransition.eventTest (self, QEvent)

This method is abstract and should be reimplemented in any sub-class.

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.

### QStateMachine QAbstractTransition.machine (self)

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

### QAbstractTransition.onTransition (self, QEvent)

This method is abstract and should be reimplemented in any sub-class.

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.

### QAbstractTransition.removeAnimation (self, QAbstractAnimation)

Removes the given animation from this transition.

See also addAnimation().

### QAbstractTransition.setTargetState (self, QAbstractState)

### QAbstractTransition.setTargetStates (self, list-of-QAbstractState)

### QState QAbstractTransition.sourceState (self)

### QAbstractState QAbstractTransition.targetState (self)

### list-of-QAbstractState QAbstractTransition.targetStates (self)

## Qt Signal Documentation

### void triggered ()

This is the default overload of this signal.

This signal is emitted when the transition has been triggered (after onTransition() has been called).