![]() |
Home |
The QtActionState class provides an action-based state. More...
#include <QtActionState>
Inherits QtAbstractState.
Inherited by QtFinalState and QtState.
The QtActionState class provides an action-based state.
QtActionState executes state actions when the state is entered and exited. QtActionState is part of The State Machine Framework.
You can add actions to a state with the addEntryAction() and addExitAction() functions. The state executes the actions when the state is entered and exited, respectively.
Built-in actions are provided for setting properties and invoking methods of QObjects. The setPropertyOnEntry() and setPropertyOnExit() functions are used for defining property assignments that should be performed when a state is entered and exited, respectively.
QLabel label; QtStateMachine machine; QtState *s1 = new QtState(); s1->setPropertyOnEntry(&label, "text", "Entered state s1"); machine.addState(s1);
The invokeMethodOnEntry() and invokeMethodOnExit() functions are used for defining method invocations that should be performed when a state is entered and exited, respectively.
QtState *s2 = new QtState(); s2->invokeMethodOnEntry(&label, "showMaximized"); machine.addState(s2);
See also QtStateAction.
This enum specifies the restore policy type for a state. The restore policy takes effect when the machine enters a state which has entry actions of the type QtStateSetPropertyAction. If the restore policy of the state is set to RestoreProperties, the state machine will save the value of the property before the QtStateSetPropertyAction is executed.
Later, when the machine either enters a state which has its restore policy set to DoNotRestoreProperties or when it enters a state which does not set a value for the given property, the property will automatically be restored to its initial value. The state machine will only detect which properties are being set if they are being set using a QtStateSetPropertyAction object set as entry action on a state.
Special rules apply when using QtAnimationState. If a QtAnimationState registers that a property should be restored before entering the target state of its QtStateFinishedTransition, it will restore this property using a QtPropertyAnimation.
Only one initial value will be saved for any given property. If a value for a property has already been saved by the state machine, it will not be overwritten until the property has been successfully restored. Once the property has been restored, the state machine will clear the initial value until it enters a new state which sets the property and which has RestoreProperties as its restore policy.
Constant | Value | Description |
---|---|---|
QtActionState::GlobalRestorePolicy | 0 | The restore policy for the state should be retrieved using QtStateMachine::globalRestorePolicy() |
QtActionState::DoNotRestoreProperties | 1 | The state machine should not save the initial values of properties set in the state and restore them later. |
QtActionState::RestoreProperties | 2 | The state machine should save the initial values of properties set in the state and restore them later. |
See also setRestorePolicy(), restorePolicy(), addEntryAction(), and setPropertyOnEntry().
Constructs a new action state with the given parent state.
Destroys this action state.
Adds the given action to this state. The action will be executed when this state is entered. The state takes ownership of the action.
See also addExitAction() and removeEntryAction().
Adds the given action to this state. The action will be executed when this state is exited. The state takes ownership of the action.
See also addEntryAction() and removeExitAction().
Returns this state's entry actions.
See also addEntryAction() and exitActions().
Returns this state's exit actions.
See also addExitAction() and entryActions().
Instructs this state to invoke the given method of the given object with the given arguments when the state is entered. This function will create a QtStateInvokeMethodAction object and add it to the entry actions of the state.
See also invokeMethodOnExit(), setPropertyOnEntry(), and addEntryAction().
Instructs this state to invoke the given method of the given object with the given arguments when the state is exited. This function will create a QtStateInvokeMethodAction object and add it to the exit actions of the state.
See also invokeMethodOnEntry(), setPropertyOnExit(), and addExitAction().
Removes the given entry action from this state. The state releases ownership of the action.
See also addEntryAction().
Removes the given exit action from this state. The state releases ownership of the action.
See also addExitAction().
Returns the restore policy for this state.
See also setRestorePolicy().
Instructs this state to set the property with the given name of the given object to the given value when the state is entered. This function will create a QtStateSetPropertyAction object and add it to the entry actions of the state. If there is already an existing action associated with the property, the value of that action is updated.
See also setPropertyOnExit(), invokeMethodOnEntry(), and addEntryAction().
Instructs this state to set the property with the given name of the given object to the given value when the state is exited. This function will create a QtStateSetPropertyAction object and add it to the exit actions of the state. If there is already an existing action associated with the property, the value of that action is updated.
See also setPropertyOnEntry(), invokeMethodOnExit(), and addExitAction().
Sets the restore policy of this state to restorePolicy.
The default restore policy is QtActionState::GlobalRestorePolicy.
See also restorePolicy().
Copyright © 2009 Nokia | Trademarks | Qt Solutions |