summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/scxml/trafficlight-common/doc/images/trafficlight.pngbin0 -> 8721 bytes
-rw-r--r--examples/scxml/trafficlight-common/doc/src/trafficlight-compiling.qdocinc19
-rw-r--r--examples/scxml/trafficlight-common/doc/src/trafficlight-state-machine.qdocinc11
-rw-r--r--examples/scxml/trafficlight-qml-dynamic/doc/src/trafficlight-qml-dynamic.qdoc38
-rw-r--r--examples/scxml/trafficlight-qml-static/doc/src/trafficlight-qml-static.qdoc34
-rw-r--r--examples/scxml/trafficlight-widgets-dynamic/doc/src/trafficlight-widgets-dynamic.qdoc42
-rw-r--r--examples/scxml/trafficlight-widgets-static/doc/src/trafficlight-widgets-static.qdoc33
7 files changed, 169 insertions, 8 deletions
diff --git a/examples/scxml/trafficlight-common/doc/images/trafficlight.png b/examples/scxml/trafficlight-common/doc/images/trafficlight.png
new file mode 100644
index 0000000..e3ce3be
--- /dev/null
+++ b/examples/scxml/trafficlight-common/doc/images/trafficlight.png
Binary files differ
diff --git a/examples/scxml/trafficlight-common/doc/src/trafficlight-compiling.qdocinc b/examples/scxml/trafficlight-common/doc/src/trafficlight-compiling.qdocinc
new file mode 100644
index 0000000..fb00130
--- /dev/null
+++ b/examples/scxml/trafficlight-common/doc/src/trafficlight-compiling.qdocinc
@@ -0,0 +1,19 @@
+ \section1 Compiling the State Machine
+
+ We link against the Qt SCXML module by adding the following line to the
+ \e .pro file:
+
+ \quotefromfile trafficlight-qml-static/trafficlight-qml-static.pro
+ \skipto QT
+ \printline scxml
+
+ We then specify the state machine to compile:
+
+ \skipto STATECHARTS
+ \printline scxml
+
+ We also tell qmake to run \c qscxmlc, which generates \e statemachine.h and
+ \e statemachine.cpp, and adds them to the \c HEADERS and \c SOURCES
+ variables for compilation:
+
+ \printuntil qscxmlc
diff --git a/examples/scxml/trafficlight-common/doc/src/trafficlight-state-machine.qdocinc b/examples/scxml/trafficlight-common/doc/src/trafficlight-state-machine.qdocinc
new file mode 100644
index 0000000..14a0619
--- /dev/null
+++ b/examples/scxml/trafficlight-common/doc/src/trafficlight-state-machine.qdocinc
@@ -0,0 +1,11 @@
+ \section1 Connecting to States
+
+ In the SCXML file, we specify states for each light: red, yellow, and green.
+ In the \c <onentry> element, we specify the event to send when entering
+ the state and the delay in seconds before sending the event. In the
+ \c <transition> element, we specify the event that triggers the transition
+ to the state specified by the \c target attribute:
+
+ \quotefromfile trafficlight-common/statemachine.scxml
+ \skipto enable-qt-mode
+ \printuntil /^ {4}\<\//
diff --git a/examples/scxml/trafficlight-qml-dynamic/doc/src/trafficlight-qml-dynamic.qdoc b/examples/scxml/trafficlight-qml-dynamic/doc/src/trafficlight-qml-dynamic.qdoc
index c2c4dc7..67ec5c8 100644
--- a/examples/scxml/trafficlight-qml-dynamic/doc/src/trafficlight-qml-dynamic.qdoc
+++ b/examples/scxml/trafficlight-qml-dynamic/doc/src/trafficlight-qml-dynamic.qdoc
@@ -27,8 +27,42 @@
/*!
\example trafficlight-qml-dynamic
- \title Qt SCXML: Traffic Light QML Example (Dynamic)
+ \title Qt SCXML Traffic Light QML Example (Dynamic)
\ingroup examples-qtscxml
- \brief Demonstrates using a state-machine for a simple traffic light.
+ \brief A Qt Quick application that uses a dynamically loaded state machine
+ to implement a traffic light.
+
+ \image trafficlight.png
+
+ \e{Traffic Light QML Example (Dynamic)} demonstrates how to connect to the
+ active properties of a state in a dynamically loaded state machine.
+
+ The UI is created using Qt Quick.
+
+ \include examples-run.qdocinc
+
+ \section1 Dynamically Loading the State Machine
+
+ We link against the Qt SCXML module by adding the following line to the
+ example \e .pro file:
+
+ \quotefromfile trafficlight-qml-dynamic/trafficlight-qml-dynamic.pro
+ \skipto QT
+ \printline scxml
+
+ We dynamically create the state machine in the main QML file:
+
+ \quotefromfile trafficlight-qml-dynamic/trafficlight-qml-dynamic.qml
+ \skipto import Scxml
+ \printuntil }
+
+ \include trafficlight-state-machine.qdocinc
+
+ We connect to the states as follows:
+
+ \quotefromfile trafficlight-common/TrafficLight.qml
+ \skipto Light
+ \printuntil greenLight
+ \printuntil /^ {4}\}/
*/
diff --git a/examples/scxml/trafficlight-qml-static/doc/src/trafficlight-qml-static.qdoc b/examples/scxml/trafficlight-qml-static/doc/src/trafficlight-qml-static.qdoc
index 6932dbc..77e7aa7 100644
--- a/examples/scxml/trafficlight-qml-static/doc/src/trafficlight-qml-static.qdoc
+++ b/examples/scxml/trafficlight-qml-static/doc/src/trafficlight-qml-static.qdoc
@@ -27,8 +27,38 @@
/*!
\example trafficlight-qml-static
- \title Qt SCXML: Traffic Light QML Example (Static)
+ \title Qt SCXML Traffic Light QML Example (Static)
\ingroup examples-qtscxml
- \brief Demonstrates using a state-machine for a simple traffic light.
+ \brief A Qt Quick application that uses a compiled state machine to
+ implement a traffic light.
+
+ \image trafficlight.png
+
+ \e{Traffic Light QML 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 Quick.
+
+ \include examples-run.qdocinc
+
+ \include trafficlight-compiling.qdocinc
+
+ \section1 Instantiating the State Machine
+
+ We instantiate the state machine as follows:
+
+ \quotefromfile trafficlight-qml-static/trafficlight-qml-static.qml
+
+ \skipto TrafficLight
+ \printuntil }
+
+ \include trafficlight-state-machine.qdocinc
+
+ We connect to the states as follows:
+
+ \quotefromfile trafficlight-common/TrafficLight.qml
+ \skipto Light
+ \printuntil greenLight
+ \printuntil /^ {4}\}/
*/
diff --git a/examples/scxml/trafficlight-widgets-dynamic/doc/src/trafficlight-widgets-dynamic.qdoc b/examples/scxml/trafficlight-widgets-dynamic/doc/src/trafficlight-widgets-dynamic.qdoc
index 236f410..de37ae0 100644
--- a/examples/scxml/trafficlight-widgets-dynamic/doc/src/trafficlight-widgets-dynamic.qdoc
+++ b/examples/scxml/trafficlight-widgets-dynamic/doc/src/trafficlight-widgets-dynamic.qdoc
@@ -27,8 +27,46 @@
/*!
\example trafficlight-widgets-dynamic
- \title Qt SCXML: Traffic Light Example (Dynamic)
+ \title Qt SCXML Traffic Light Example (Dynamic)
\ingroup examples-qtscxml
- \brief Demonstrates using a state-machine for a simple traffic light.
+ \brief A widget-based application that uses a dynamically loaded state
+ machine to implement a traffic light.
+
+ \image trafficlight.png
+
+ \e{Traffic Light Example (Dynamic)} demonstrates how to connect to the
+ active properties of a state in a dynamically loaded state machine.
+
+ The UI is created using Qt Widgets.
+
+ \include examples-run.qdocinc
+
+ \section1 Dynamically Loading the State Machine
+
+ We link against the Qt SCXML module by adding the following line to the
+ example \e .pro file:
+
+ \quotefromfile trafficlight-widgets-dynamic/trafficlight-widgets-dynamic.pro
+ \skipto QT
+ \printline scxml
+
+ We dynamically create the state machine in
+ \e trafficlight-widgets-dynamic.cpp:
+
+ \quotefromfile trafficlight-widgets-dynamic/trafficlight-widgets-dynamic.cpp
+ \skipto trafficlight.h
+ \printuntil /^ {4}\}/
+
+ And then instantiate it:
+
+ \printuntil /^\}/
+
+ \include trafficlight-state-machine.qdocinc
+
+ We connect to the states as follows:
+
+ \quotefromfile trafficlight-common/trafficlight.cpp
+ \skipto connectToState
+ \printuntil greenLight
*/
diff --git a/examples/scxml/trafficlight-widgets-static/doc/src/trafficlight-widgets-static.qdoc b/examples/scxml/trafficlight-widgets-static/doc/src/trafficlight-widgets-static.qdoc
index 03e0680..a807f22 100644
--- a/examples/scxml/trafficlight-widgets-static/doc/src/trafficlight-widgets-static.qdoc
+++ b/examples/scxml/trafficlight-widgets-static/doc/src/trafficlight-widgets-static.qdoc
@@ -27,8 +27,37 @@
/*!
\example trafficlight-widgets-static
- \title Qt SCXML: Traffic Light Example (Static)
+ \title Qt SCXML Traffic Light Example (Static)
\ingroup examples-qtscxml
- \brief Demonstrates using a state-machine for a simple traffic light.
+ \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
*/