From 288de11968d4b71c97fc5d1a175d4c4ac7023552 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 13 May 2009 11:01:32 +0200 Subject: doc: Correct names of snippets in docs for Tank Game example --- doc/src/examples/tankgame.qdoc | 2 +- examples/statemachine/tankgame/mainwindow.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/src/examples/tankgame.qdoc b/doc/src/examples/tankgame.qdoc index e10161c..1501a99 100644 --- a/doc/src/examples/tankgame.qdoc +++ b/doc/src/examples/tankgame.qdoc @@ -98,7 +98,7 @@ This is done by setting the error state of the plugin's top-most state to a special error state defined specifically for the plugin in question. - \snippet examples/statemachine/tankgame/mainwindow.cpp 3 + \snippet examples/statemachine/tankgame/mainwindow.cpp 4 If a run-time error occurs in \c pluginState or any of its descendants, the state machine will search the hierarchy of ancestors until it finds a state whose error state is different from diff --git a/examples/statemachine/tankgame/mainwindow.cpp b/examples/statemachine/tankgame/mainwindow.cpp index 3bc9bbe..870bc9c 100644 --- a/examples/statemachine/tankgame/mainwindow.cpp +++ b/examples/statemachine/tankgame/mainwindow.cpp @@ -135,8 +135,10 @@ void MainWindow::init() spawnsAvailable->addTransition(this, SIGNAL(mapFull()), noSpawnsAvailable); +//! [3] QHistoryState *hs = new QHistoryState(stoppedState); hs->setDefaultState(spawnsAvailable); +//! [3] stoppedState->setInitialState(hs); @@ -255,9 +257,11 @@ void MainWindow::addTank() // If the plugin has an error it is disabled +//! [4] QState *errorState = new QState(region); errorState->assignProperty(tankItem, "enabled", false); pluginState->setErrorState(errorState); +//! [4] } } } -- cgit v0.12