summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine/qstate.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-04-29 09:40:38 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-04-29 09:41:13 (GMT)
commitfa612960f423aa413d6d83813807a470aef27d7d (patch)
tree0eda17fc34fd88831cb15168b28eba0e1ca4e5a3 /src/corelib/statemachine/qstate.cpp
parentc731d50a8ac908da982c911c73509cdd766c4c0f (diff)
downloadQt-fa612960f423aa413d6d83813807a470aef27d7d.zip
Qt-fa612960f423aa413d6d83813807a470aef27d7d.tar.gz
Qt-fa612960f423aa413d6d83813807a470aef27d7d.tar.bz2
replace QState::Type with QState::childMode property
Result of API review.
Diffstat (limited to 'src/corelib/statemachine/qstate.cpp')
-rw-r--r--src/corelib/statemachine/qstate.cpp58
1 files changed, 47 insertions, 11 deletions
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index dd3af51..5b49f1f 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -81,20 +81,37 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \enum QState::Type
+ \property QState::initialState
- This enum specifies the type of a state.
+ \brief the initial state of this state
+*/
+
+/*!
+ \property QState::errorState
+
+ \brief the error state of this state
+*/
+
+/*!
+ \property QState::childMode
+
+ \brief the child mode of this state
+*/
+
+/*!
+ \enum QState::ChildMode
+
+ This enum specifies how a state's child states are treated.
- \value Normal A normal state. If the state has no child states, it is an
- atomic state; otherwise, the child states are mutually exclusive and an
+ \value ExclusiveStates The child states are mutually exclusive and an
initial state must be set by calling QState::setInitialState().
- \value ParallelGroup The state is a parallel group state. When a parallel
- group state is entered, all its child states are entered in parallel.
+ \value ParallelStates The child states are parallel. When the parent state
+ is entered, all its child states are entered in parallel.
*/
QStatePrivate::QStatePrivate()
- : errorState(0), isParallelGroup(false), initialState(0)
+ : errorState(0), initialState(0), childMode(QState::ExclusiveStates)
{
}
@@ -131,13 +148,14 @@ QState::QState(QState *parent)
}
/*!
- Constructs a new state of the given \a type with the given \a parent state.
+ Constructs a new state with the given \a childMode and the given \a parent
+ state.
*/
-QState::QState(Type type, QState *parent)
+QState::QState(ChildMode childMode, QState *parent)
: QAbstractState(*new QStatePrivate, parent)
{
Q_D(QState);
- d->isParallelGroup = (type == ParallelGroup);
+ d->childMode = childMode;
}
/*!
@@ -393,7 +411,7 @@ QAbstractState *QState::initialState() const
void QState::setInitialState(QAbstractState *state)
{
Q_D(QState);
- if (d->isParallelGroup) {
+ if (d->childMode == QState::ParallelStates) {
qWarning("QState::setInitialState: ignoring attempt to set initial state "
"of parallel state group %p", this);
return;
@@ -407,6 +425,24 @@ void QState::setInitialState(QAbstractState *state)
}
/*!
+ Returns the child mode of this state.
+*/
+QState::ChildMode QState::childMode() const
+{
+ Q_D(const QState);
+ return d->childMode;
+}
+
+/*!
+ Sets the child \a mode of this state.
+*/
+void QState::setChildMode(ChildMode mode)
+{
+ Q_D(QState);
+ d->childMode = mode;
+}
+
+/*!
\reimp
*/
bool QState::event(QEvent *e)