summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/statemachine/main2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/snippets/statemachine/main2.cpp')
-rw-r--r--doc/src/snippets/statemachine/main2.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/doc/src/snippets/statemachine/main2.cpp b/doc/src/snippets/statemachine/main2.cpp
index 2419dc2..9a2890f 100644
--- a/doc/src/snippets/statemachine/main2.cpp
+++ b/doc/src/snippets/statemachine/main2.cpp
@@ -69,17 +69,18 @@ int main(int argv, char **args)
//![1]
QButton *interruptButton = new QPushButton("Interrupt Button");
+ QWidget *mainWindow = new QWidget();
//![3]
QHistoryState *s1h = new QHistoryState(s1);
QState *s3 = new QState();
s3->assignProperty(label, "text", "In s3");
- QMessageBox mbox;
- mbox.addButton(QMessageBox::Ok);
- mbox.setText("Interrupted!");
- mbox.setIcon(QMessageBox::Information);
- QObject::connect(s3, SIGNAL(entered()), &mbox, SLOT(exec()));
+ QMessageBox *mbox = new QMessageBox(mainWindow);
+ mbox->addButton(QMessageBox::Ok);
+ mbox->setText("Interrupted!");
+ mbox->setIcon(QMessageBox::Information);
+ QObject::connect(s3, SIGNAL(entered()), mbox, SLOT(exec()));
s3->addTransition(s1h);
machine.addState(s3);