summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2009-09-07 12:53:59 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2009-09-07 12:54:51 (GMT)
commit23e1c7afed25ccb95cc24d2caa692853f35464ec (patch)
treec1413405d3b7944f53ed3028cdaa7bcd72c87625 /doc
parentf868eae7d0cd3297e2512b5651747fda689cc848 (diff)
downloadQt-23e1c7afed25ccb95cc24d2caa692853f35464ec.zip
Qt-23e1c7afed25ccb95cc24d2caa692853f35464ec.tar.gz
Qt-23e1c7afed25ccb95cc24d2caa692853f35464ec.tar.bz2
Doc: Added a note that a state machine requires a running event loop.
Reviewed-by: Trust Me
Diffstat (limited to 'doc')
-rw-r--r--doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp b/doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp
new file mode 100644
index 0000000..128799f
--- /dev/null
+++ b/doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp
@@ -0,0 +1,15 @@
+//! [simple state machine]
+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();
+//! [simple state machine]