![]() |
Home |
The QtStateGroup class manages a mutually exclusive group of states. More...
#include <QtStateGroup>
This class is under development and is subject to change.
Inherits QObject.
This class was introduced in qtanimationframework 4.5.
The QtStateGroup class manages a mutually exclusive group of states.
You can make states mutually exclusive by adding them to the same QtStateGroup. The state group will ensure that only one state can be active at any time, and it also provides an optional default state as a fallback, when no other state is active.
To create a group, simply construct a QtStateGroup object. It's common to pass the state owner as the parent for a QtStateGroup (i.e., for two QtState objects that share the same widget parent, the QtStateGroup can have the same widget parent). Then add states by calling addState(), or remove them by calling removeState(). If you want to list all states in the group, you can call states(). If you add a QtState, or any QtState subclass as a child of a QtStateGroup, it will automatically become a member of that state.
The group can only have one active state. You can set the active state by either calling setActiveState(), or you can call QtState::setActive(true) directly on the state itself. When you activate a state, QtStateGroup will take care of deactivating the last state (if any). If you want to deactivate the active state, you can either call setActiveState(0), or QtState::setActive(false). When the active state changes, QtStateGroup emits the activeStateChanged() signal.
Sometimes it's useful to define a "default state" that the group should revert to, should any of the other states become deactivated without activating another state (e.g., hitting "escape" on a form might revert it to its default state, regardless of which state is currently active). You can do so by passing a pointer to the default state to setDefaultState().
See also QtState and The Animation Framework.
Constructs a QtStateGroup, passing parent to QObject's constructor.
Destroys the QtStateGroup.
Returns a pointer to the active state if there is an active state; otherwise, 0 is returned.
See also setActiveState().
QtStateGroup emits this signal every time the active state changes. state is the new state, or 0 if there is no active state.
See also QtState::setActive().
Adds state to this group. If state is already active, it will become this group's active state.
The ownership of state is transferred to this group.
See also QtState::isActive() and activeState().
Returns the default state of the group. The default state is part of this group, and is automatically activated if the active state is deactivated. If the group does not have a default state, 0 will be returned. (e.g., if you call setActiveState(0), or QtState::setActive(false)).
See also setDefaultState().
Removes state from this group. If state is the default state, the default state will be reset to 0. If state is the active state, the state will first be deactivated, and then removed from this group. The group will then revert to the default state, or 0 if there is no default state.
The ownership of state is transferred to the caller (i.e., this function does not delete state).
See also defaultState(), activeState(), and QtState::isActive().
Sets state, which must either be part of this group or 0, to be the active state in this group. If state is 0, any active state is deactivated, and if the group has a default state, the default state is automatically activated.
Calling this function is equivalent to calling QtState::setActive() on one of the states in the group.
See also activeState() and defaultState().
Sets state, which must be part of this group, to be this group's default state. The default state is automatically activated if the active state is deactivated (e.g., if you call setActiveState(0), or QtState::setActive(false)). If there is no default state when the active state is deactivated, then the group's active state will be 0 (i.e., no state is active).
See also defaultState().
Returns all states that are part of this group.
See also addState() and removeState().
Copyright © 2008 Nokia | Trademarks | Qt Solutions |