|  | 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 animation)
- unknown-type animations (self)
- bool event (self, QEvent e)
- bool eventTest (self, QEvent event)
- QStateMachine machine (self)
- onTransition (self, QEvent event)
- removeAnimation (self, QAbstractAnimation animation)
- setTargetState (self, QAbstractState target)
- setTargetStates (self, unknown-type targets)
- QState sourceState (self)
- QAbstractState targetState (self)
- unknown-type 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)

The sourceState argument, if not None, causes self to be owned by Qt instead of PyQt.

Constructs a new QAbstractTransition object with the given sourceState.

### QAbstractTransition.addAnimation (self, QAbstractAnimation animation)

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

See also removeAnimation() and animations().

### unknown-type 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 e)

Reimplemented from QObject.event().

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

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 event)

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 animation)

Removes the given animation from this transition.

See also addAnimation().

### QAbstractTransition.setTargetState (self, QAbstractState target)

### QAbstractTransition.setTargetStates (self, unknown-type targets)

### QState QAbstractTransition.sourceState (self)

### QAbstractState QAbstractTransition.targetState (self)

### unknown-type 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).