summaryrefslogtreecommitdiffstats
path: root/examples/statemachine/animation/sub-attaq/graphicsscene.cpp
diff options
context:
space:
mode:
authorTamas Martinec <tamas.martinec@symbio.com>2021-03-16 16:25:53 +0200
committerTamas Martinec <tamas.martinec@symbio.com>2021-03-24 09:40:58 +0200
commite6db5a7e0e74b153ba9cbe1d376bd7c49cfdbe49 (patch)
treed5d3a5acdca548809a28dd1ba923140b22546f8a /examples/statemachine/animation/sub-attaq/graphicsscene.cpp
parent3f5d1807eaa8601a5812b01657f1ed4837ff6ec3 (diff)
Add documentation to the Sub-attaq example
Pick-to: 6.1 Task-number: QTBUG-89834 Change-Id: I75198b11f75a202bba3843a57e94e8f5db259210 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/statemachine/animation/sub-attaq/graphicsscene.cpp')
-rw-r--r--examples/statemachine/animation/sub-attaq/graphicsscene.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/statemachine/animation/sub-attaq/graphicsscene.cpp b/examples/statemachine/animation/sub-attaq/graphicsscene.cpp
index d8c068a..cbc04c8 100644
--- a/examples/statemachine/animation/sub-attaq/graphicsscene.cpp
+++ b/examples/statemachine/animation/sub-attaq/graphicsscene.cpp
@@ -74,6 +74,7 @@
GraphicsScene::GraphicsScene(int x, int y, int width, int height, Mode mode, QObject *parent)
: QGraphicsScene(x, y, width, height, parent), mode(mode), boat(new Boat)
{
+//![2]
PixmapItem *backgroundItem = new PixmapItem(QStringLiteral("background"), mode);
backgroundItem->setZValue(1);
backgroundItem->setPos(0,0);
@@ -97,6 +98,7 @@ GraphicsScene::GraphicsScene(int x, int y, int width, int height, Mode mode, QOb
addItem(boat);
boat->setPos(this->width()/2, sealLevel() - boat->size().height());
boat->hide();
+//![2]
//Parse the xml that contains all data of the game
QXmlStreamReader reader;
@@ -173,6 +175,7 @@ void GraphicsScene::setupScene(QAction *newAction, QAction *quitAction)
fadeAnim->setEasingCurve(QEasingCurve::OutQuad);
}
+//![3]
QStateMachine *machine = new QStateMachine(this);
//This state is when the player is playing
@@ -207,6 +210,7 @@ void GraphicsScene::setupScene(QAction *newAction, QAction *quitAction)
//We reach the final state, then we quit
connect(machine, &QStateMachine::finished, qApp, &QApplication::quit);
+//![3]
}
void GraphicsScene::addItem(Bomb *bomb)