summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2009-09-07 14:53:59 +0200
committerDavid Boddie <dboddie@trolltech.com>2009-09-07 14:54:51 +0200
commit23e1c7afed25ccb95cc24d2caa692853f35464ec (patch)
treec1413405d3b7944f53ed3028cdaa7bcd72c87625 /src/corelib/statemachine
parentf868eae7d0cd3297e2512b5651747fda689cc848 (diff)
Doc: Added a note that a state machine requires a running event loop.
Reviewed-by: Trust Me
Diffstat (limited to 'src/corelib/statemachine')
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp42
1 files changed, 11 insertions, 31 deletions
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index f562fb38f3..a5cdd45dd5 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -78,13 +78,13 @@
QT_BEGIN_NAMESPACE
/*!
- \class QStateMachine
- \reentrant
+ \class QStateMachine
+ \reentrant
- \brief The QStateMachine class provides a hierarchical finite state machine.
+ \brief The QStateMachine class provides a hierarchical finite state machine.
- \since 4.6
- \ingroup statemachine
+ \since 4.6
+ \ingroup statemachine
QStateMachine is based on the concepts and notation of
\l{Statecharts: A visual formalism for complex
@@ -128,21 +128,7 @@ QT_BEGIN_NAMESPACE
The following snippet shows a state machine that will finish when a button
is clicked:
- \code
- QPushButton button;
-
- QStateMachine machine;
- QState *s1 = new QState();
- s1->assignProperty(&button, "text", "Click me");
-
- QFinalState *s2 = new QFinalState();
- s1->addTransition(&button, SIGNAL(clicked()), s2);
-
- machine.addState(s1);
- machine.addState(s2);
- machine.setInitialState(s1);
- machine.start();
- \endcode
+ \snippet doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp simple state machine
This code example uses QState, which inherits QAbstractState. The
QState class provides a state that you can use to set properties
@@ -160,17 +146,7 @@ QT_BEGIN_NAMESPACE
no error state applies to the erroneous state, the machine will stop
executing and an error message will be printed to the console.
- \omit This stuff will be moved elsewhere
-This is
- typically used in conjunction with \l{Signals and Slots}{signals}; the
- signals determine the flow of the state graph, whereas the states' property
- assignments and method invocations are the actions.
-
- The postEvent() function posts an event to the state machine. This is useful
- when you are using custom events to trigger transitions.
- \endomit
-
- \sa QAbstractState, QAbstractTransition, QState, {The State Machine Framework}
+ \sa QAbstractState, QAbstractTransition, QState, {The State Machine Framework}
*/
/*!
@@ -1748,6 +1724,10 @@ bool QStateMachine::isRunning() const
transition to the initial state. When a final top-level state (QFinalState)
is entered, the machine will emit the finished() signal.
+ \note A state machine will not run without a running event loop, such as
+ the main application event loop started with QCoreApplication::exec() or
+ QApplication::exec().
+
\sa started(), finished(), stop(), initialState()
*/
void QStateMachine::start()