summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-05-12 14:33:28 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-05-12 14:33:28 (GMT)
commitcb516fd65149991a2105c545192a52f26a6ab67d (patch)
tree8f32bd5462fa076a897df6df1888f45365f63ca2 /examples
parent4ece5c8923e559643f79833146d02a3976021f63 (diff)
downloadQt-cb516fd65149991a2105c545192a52f26a6ab67d.zip
Qt-cb516fd65149991a2105c545192a52f26a6ab67d.tar.gz
Qt-cb516fd65149991a2105c545192a52f26a6ab67d.tar.bz2
Fixes: document statemachine/twowaybutton example
Diffstat (limited to 'examples')
-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 61a0f32..a2c6e45 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]