QAbstractTransition Class
The QAbstractTransition class is the base class of transitions between QAbstractState objects. More...
| Header: | #include <QAbstractTransition> |
| qmake: | QT += core |
| Since: | Qt 4.6 |
| Inherits: | QObject |
| Inherited By: |
This class was introduced in Qt 4.6.
Public Types
| enum | TransitionType { ExternalTransition, InternalTransition } |
Properties
- sourceState : QState* const
- targetState : QAbstractState*
- targetStates : QList<QAbstractState*>
- transitionType : TransitionType
Public Functions
| void | setTargetState(QAbstractState *target) |
| void | setTargetStates(const QList<QAbstractState *> &targets) |
| void | setTransitionType(QAbstractTransition::TransitionType type) |
| QState * | sourceState() const |
| QAbstractState * | targetState() const |
| QList<QAbstractState *> | targetStates() const |
| QAbstractTransition::TransitionType | transitionType() const |
Signals
| void | targetStateChanged() |
| void | targetStatesChanged() |
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.
Member Type Documentation
enum QAbstractTransition::TransitionType
This enum specifies the kind of transition. By default, the type is an external transition.
| Constant | Value | Description |
|---|---|---|
QAbstractTransition::ExternalTransition | 0 | 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 | 1 | 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 QAbstractTransition::transitionType.
Property Documentation
sourceState : QState* const
This property holds the source state (parent) of this transition
Access functions:
| QState * | sourceState() const |
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:
| QAbstractState * | targetState() const |
| void | setTargetState(QAbstractState *target) |
Notifier signal:
| void | targetStateChanged() | [see note below] |
Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.
targetStates : QList<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:
| QList<QAbstractState *> | targetStates() const |
| void | setTargetStates(const QList<QAbstractState *> &targets) |
Notifier signal:
| void | targetStatesChanged() | [see note below] |
Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.
transitionType : TransitionType
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:
| QAbstractTransition::TransitionType | transitionType() const |
| void | setTransitionType(QAbstractTransition::TransitionType type) |