summaryrefslogtreecommitdiffstats
path: root/examples/scxml/trafficlight-widgets-static/doc/src/trafficlight-widgets-static.qdoc
blob: a79da0fe8f6fc60e7346aab357a51967bde4bd9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \example trafficlight-widgets-static
    \title SCXML Traffic Light (Static, Widgets)
    \examplecategory {Data Processing & I/O}
    \ingroup examples-qtscxml

    \brief A widget-based application that uses a compiled state machine to
    implement a traffic light.

    \image trafficlight.png

    \e{Traffic Light Example (Static)} demonstrates how to connect to the
    active properties of a state in a state machine that is compiled to a class.

    The UI is created using Qt Widgets.

    \include examples-run.qdocinc

    \include trafficlight-compiling.qdocinc

    \section1 Instantiating the State Machine

    We instantiate the generated \c TrafficLightStateMachine class in the
    \e trafficlight-widgets-static.cpp file, as follows:

    \quotefromfile trafficlight-widgets-static/trafficlight-widgets-static.cpp
    \skipto #include
    \printuntil }

    \include trafficlight-state-machine.qdocinc

    We connect to the states as follows:

    \quotefromfile trafficlight-common/trafficlight.cpp
    \skipto connectToState
    \printuntil greenLight
*/