Revision control
- // Copyright (C) 2016 The Qt Company Ltd.
- // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
- /*!
- \example calculator-widgets
- \title Qt SCXML Calculator Example
- \ingroup examples-qtscxml
-
- \image calculator.png
-
- \brief A widget-based application that implements the Calculator example
- presented in the SCXML Specification.
-
- \e {Calculator} uses Qt SCXML to implement the
- \l{SCXML Specification - Calculator Example}{Calculator Example}
- presented in the SCXML Specification.
-
- The state machine is specified in the \e statemachine.scxml file and
- compiled into the \c CalculatorStateMachine class. The user interface is
- created using Qt Widgets.
-
- \include examples-run.qdocinc
-
- \include calculator-compiling.qdocinc
-
- \section1 Instantiating the State Machine
-
- We instantiate the generated \c CalculatorStateMachine class in the
- \e calculator-widgets.cpp file, as follows:
-
- \quotefromfile calculator-widgets/calculator-widgets.cpp
- \skipto #include
- \printuntil }
-
- \section1 Connecting to Active Properties
-
- After instantiating the state machine, we can connect to the active
- properties of the states, as follows:
-
- \quotefromfile calculator-widgets/mainwindow.cpp
- \skipto connect
- \printuntil digit2
- \printuntil }
-
- The state machine can notify other code when events occur:
-
- \quotefromfile calculator-common/statemachine.scxml
- \skipto transition event="DISPLAY.UPDATE
- \printuntil </transition
-
- We connect to the \c updateDisplay event to display the data passed by
- the events:
-
- \quotefromfile calculator-widgets/mainwindow.cpp
- \skipto connectToEvent
- \printuntil });
- */