![]() |
Home |
The QtState class provides a general-purpose state for QtStateMachine. More...
#include <QtState>
Inherits QtActionState.
Inherited by QtAnimationState.
The QtState class provides a general-purpose state for QtStateMachine.
QtState objects can have child states, and can have transitions to other states. QtState is part of The State Machine Framework.
The addTransition() function adds a transition. The removeTransition() function removes a transition.
For non-parallel state groups, the setInitialState() function must be called to set the initial state. The child states are mutually exclusive states, and the state machine needs to know which child state to enter when the parent state is the target of a transition.
The addHistoryState() function adds a history state.
The setErrorState() sets the state's error state. The error state is the state that the state machine will transition to if an error is detected when attempting to enter the state (e.g. because no initial state has been set).
This enum specifies the type of history that a QtHistoryState records.
Constant | Value | Description |
---|---|---|
QtState::ShallowHistory | 0 | Only the immediate child states of the parent state are recorded. In this case a transition with the history state as its target will end up in the immediate child state that the parent was in the last time it was exited. This is the default. |
QtState::DeepHistory | 1 | Nested states are recorded. In this case a transition with the history state as its target will end up in the most deeply nested descendant state the parent was in the last time it was exited. |
This enum specifies the type of a state.
Constant | Value | Description |
---|---|---|
QtState::Normal | 0 | A normal state. If the state has no child states, it is an atomic state; otherwise, the child states are mutually exclusive and an initial state must be set by calling QtState::setInitialState(). |
QtState::ParallelGroup | 1 | The state is a parallel group state. When a parallel group state is entered, all its child states are entered in parallel. |
Constructs a new state with the given parent state.
Constructs a new state of the given type with the given parent state.
Destroys this state.
Adds an animated transition from the current state to targetState.
The animated transition has an intermediate QtAnimationState which plays animation before entering targetState. This QtAnimationState will be entered when transition is taken by the state machine. When the animation has finished playing, the targetState will be entered.
The new QtAnimationState object will become a child of targetState's parent state.
QPushButton button; QtPropertyAnimation animation(&button, "geometry"); animation.setEndValue(QRect(100, 100, 400, 400)); QtStateMachine machine; QtState *s1 = new QtState(); QtState *s2 = new QtState(); QtTransition *transition = new QtTransition(MyEventType); s1->addAnimatedTransition(transition, s2, &animation);
The function returns the new QtAnimationState. This state can be used if you want to add additional transitions into or out from the animation state, and if you want to add additional animations.
See also QtAnimationState.
This is an overloaded member function, provided for convenience.
Adds an animated transition from the current state to targetState for animation.
This function creates a QtSignalTransition for the sender and signal, and calls addAnimatedTransition() with this transition object.
Adds a transition that's triggered by the finished event of this state, and that has the given target state.
See also QtStateFinishedEvent.
Creates a history state of the given type for this state and returns the new state. The history state becomes a child of this state.
Adds the given transition. The transition has this state as the source, and the given target as the target state.
See also removeTransition().
This is an overloaded member function, provided for convenience.
Adds the given transition. The transition has this state as the source, and the given targets as the target states.
This is an overloaded member function, provided for convenience.
Adds a transition associated with the given signal of the given sender object. The transition has this state as the source, and the given target as the target state.
This is an overloaded member function, provided for convenience.
Adds the given transition. The transition has this state as the source, and has no target.
This is an overloaded member function, provided for convenience.
Adds an unconditional transition from this state to the given target state.
Returns this state group's error state.
See also QtStateMachine::errorState() and QtStateMachine::setErrorState().
Returns this state's initial state, or 0 if the state has no initial state.
See also setInitialState().
Removes the given transition from this state. The state releases ownership of the transition.
See also addTransition().
Sets this state's error state to be the given state. If the error state is not set, or if it is set to 0, the state will inherit its parent's error state recursively.
See also QtStateMachine::setErrorState() and QtStateMachine::errorState().
Sets this state's initial state to be the given state. state has to be a child of this state.
See also initialState().
Copyright © 2009 Nokia | Trademarks | Qt Solutions |