diff options
author | Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> | 2016-03-03 13:43:56 +0100 |
---|---|---|
committer | Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> | 2016-03-03 15:37:17 +0000 |
commit | 7357304a24dbdd34a1a3d7546e3d181baa24bd64 (patch) | |
tree | 15179ab19950b8ca5942eac2e52f81613d3045d5 /examples | |
parent | a67aadf4c2186043d703d7364e085fc661fe343b (diff) |
Doc: add docs for Calculator example
Change-Id: I1a8c3407cec865ca9684e18896a89f73a9cde016
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/scxml/calculator/doc/src/calculator.qdoc | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/examples/scxml/calculator/doc/src/calculator.qdoc b/examples/scxml/calculator/doc/src/calculator.qdoc index 9edb0c3..e6e91c8 100644 --- a/examples/scxml/calculator/doc/src/calculator.qdoc +++ b/examples/scxml/calculator/doc/src/calculator.qdoc @@ -39,5 +39,54 @@ \l{SCXML Specification - Calculator Example}{Calculator Example} presented in the SCXML Specification. + The state machine is specified in the \e calculator.scxml file and compiled + into the \c Calculator class. The user interface is created using + Qt Widgets. + \include examples-run.qdocinc + + \section1 Compiling the State Machine + + We link against the Qt SCXML module by adding the following line to the + \e calculator.pro file: + + \quotefromfile calculator/calculator.pro + \printuntil scxml + + We then specify the state machine to compile: + + \skipto STATECHARTS + \printline calculator + + We also tell qmake to run \c qscxmlc, which generates \e calculator.h and + \e calculator.cpp, and adds them to the \c HEADERS and \c SOURCES variables + for compilation: + + \skipto load + \printline qscxmlc + + \section1 Instantiating the State Machine + + We instantiate the generated \c Calculator class in the \e main.cpp file, as + follows: + + \quotefromfile calculator/main.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/mainwindow.cpp + \skipto connect + \printuntil digit2 + \printuntil } + + To be notified when a state machine sends out an event, we connect to the + corresponding signal: + + \skipto eventOccurred + \printuntil }); */ |