summaryrefslogtreecommitdiffstats
path: root/examples/statemachine
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-05-12 16:33:28 +0200
committerKent Hansen <khansen@trolltech.com>2009-05-12 16:33:28 +0200
commitcb516fd65149991a2105c545192a52f26a6ab67d (patch)
tree8f32bd5462fa076a897df6df1888f45365f63ca2 /examples/statemachine
parent4ece5c8923e559643f79833146d02a3976021f63 (diff)
Fixes: document statemachine/twowaybutton example
Diffstat (limited to 'examples/statemachine')
-rw-r--r--examples/statemachine/twowaybutton/main.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/examples/statemachine/twowaybutton/main.cpp b/examples/statemachine/twowaybutton/main.cpp
index 61a0f320cd..a2c6e45b65 100644
--- a/examples/statemachine/twowaybutton/main.cpp
+++ b/examples/statemachine/twowaybutton/main.cpp
@@ -45,34 +45,42 @@
#include <qstatemachine.h>
#endif
+//! [0]
int main(int argc, char **argv)
{
QApplication app(argc, argv);
-
QPushButton button;
-
QStateMachine machine;
- QState *first = new QState();
- first->setObjectName("first");
+//! [0]
+//! [1]
QState *off = new QState();
off->assignProperty(&button, "text", "Off");
off->setObjectName("off");
- first->addTransition(off);
QState *on = new QState();
on->setObjectName("on");
on->assignProperty(&button, "text", "On");
+//! [1]
+
+//! [2]
off->addTransition(&button, SIGNAL(clicked()), on);
on->addTransition(&button, SIGNAL(clicked()), off);
+//! [2]
- machine.addState(first);
+//! [3]
machine.addState(off);
machine.addState(on);
- machine.setInitialState(first);
+//! [3]
+
+//! [4]
+ machine.setInitialState(off);
machine.start();
+//! [4]
+//! [5]
button.resize(100, 50);
button.show();
return app.exec();
}
+//! [5]