diff options
32 files changed, 375 insertions, 171 deletions
diff --git a/examples/scxml/calculator-common/doc/src/calculator-compiling.qdocinc b/examples/scxml/calculator-common/doc/src/calculator-compiling.qdocinc index 3e5982f..e281df7 100644 --- a/examples/scxml/calculator-common/doc/src/calculator-compiling.qdocinc +++ b/examples/scxml/calculator-common/doc/src/calculator-compiling.qdocinc @@ -1,16 +1,30 @@ \section1 Compiling the State Machine - We link against the Qt SCXML module by adding the following line to the - \e .pro file: + We link against the Qt SCXML module by adding the following lines to the + example's build files. + + \section2 \e .pro when using qmake: \quotefromfile calculator-widgets/calculator-widgets.pro - \printuntil scxml + \skipto QT + \printline scxml We then specify the state machine to compile: - \skipto STATECHARTS - \printuntil statemachine.scxml + \printline scxml + + \section2 \e CMakeLists.txt when using cmake: + \quotefromfile calculator-widgets/CMakeLists.txt + \skipto find_package + \printline Scxml + \skipto target_link_libraries + \printuntil ) + + We then specify the state machine to compile: + \skipto qt6_add_statecharts + \printuntil ) - The Qt SCXML Compiler, \c qscxmlc, is run automatically to generate - \e statemachine.h and \e statemachine.cpp, and to add them to the \c HEADERS - and \c SOURCES variables for compilation. + The statechart directives \e STATECHARTS or \e qt6_add_statecharts invoke the Qt SCXML + Compiler, \c qscxmlc, which is run automatically to generate \e statemachine.h and + \e statemachine.cpp, which are then added appropriately as headers and sources for + compilation. diff --git a/examples/scxml/calculator-qml/doc/src/calculator-qml.qdoc b/examples/scxml/calculator-qml/doc/src/calculator-qml.qdoc index e58fcfd..8ab7e05 100644 --- a/examples/scxml/calculator-qml/doc/src/calculator-qml.qdoc +++ b/examples/scxml/calculator-qml/doc/src/calculator-qml.qdoc @@ -60,7 +60,7 @@ \quotefromfile calculator-qml/calculator-qml.qml \skipto CalculatorStateMachine - \printline 1.0 + \printline CalculatorStateMachine We instantiate a CalculatorStateMachine and listen to the \c updateDisplay event. When it occurs, we change the text on the calculator display: diff --git a/examples/scxml/calculator-widgets/CMakeLists.txt b/examples/scxml/calculator-widgets/CMakeLists.txt index 70d2324..2e64af4 100644 --- a/examples/scxml/calculator-widgets/CMakeLists.txt +++ b/examples/scxml/calculator-widgets/CMakeLists.txt @@ -15,10 +15,7 @@ endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/scxml/calculator-widgets") -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Widgets) -find_package(Qt6 COMPONENTS Scxml) +find_package(Qt6 COMPONENTS Core Gui Widgets Scxml) qt_add_executable(calculator-widgets calculator-widgets.cpp @@ -29,13 +26,12 @@ set_target_properties(calculator-widgets PROPERTIES MACOSX_BUNDLE TRUE ) target_link_libraries(calculator-widgets PUBLIC - Qt::Core - Qt::Gui - Qt::Scxml - Qt::Widgets + Qt6::Core + Qt6::Gui + Qt6::Scxml + Qt6::Widgets ) - # Statecharts: qt6_add_statecharts(calculator-widgets ../calculator-common/statemachine.scxml diff --git a/examples/scxml/ftpclient/CMakeLists.txt b/examples/scxml/ftpclient/CMakeLists.txt index 6ddea9e..f5e1175 100644 --- a/examples/scxml/ftpclient/CMakeLists.txt +++ b/examples/scxml/ftpclient/CMakeLists.txt @@ -15,9 +15,7 @@ endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/scxml/ftpclient") -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Scxml) -find_package(Qt6 COMPONENTS Network) +find_package(Qt6 COMPONENTS Core Scxml Network) qt_add_executable(ftpclient ftpcontrolchannel.cpp ftpcontrolchannel.h @@ -29,12 +27,11 @@ set_target_properties(ftpclient PROPERTIES MACOSX_BUNDLE TRUE ) target_link_libraries(ftpclient PUBLIC - Qt::Core - Qt::Network - Qt::Scxml + Qt6::Core + Qt6::Network + Qt6::Scxml ) - # Statecharts: qt6_add_statecharts(ftpclient simpleftp.scxml diff --git a/examples/scxml/ftpclient/doc/src/ftpclient.qdoc b/examples/scxml/ftpclient/doc/src/ftpclient.qdoc index b69994d..42b4437 100644 --- a/examples/scxml/ftpclient/doc/src/ftpclient.qdoc +++ b/examples/scxml/ftpclient/doc/src/ftpclient.qdoc @@ -67,19 +67,31 @@ \section1 Compiling the State Machine We link against the Qt SCXML module by adding the following line to the - \e .pro file: + project build files. + With qmake, we add the following to \e ftpclient.pro \quotefromfile ftpclient/ftpclient.pro - \printuntil scxml + \skipto QT + \printline scxml We then specify the state machine to compile: - \skipto STATECHARTS - \printuntil simpleftp.scxml + \printline scxml + + With CMake, we add the following to \e CMakeLists.txt + \quotefromfile ftpclient/CMakeLists.txt + \skipto find_package + \printline Scxml + \skipto target_link_libraries + \printuntil ) + + We then specify the state machine to compile: + \skipto qt6_add_statecharts + \printuntil ) The Qt SCXML Compiler, \c qscxmlc, is run automatically to generate - \e ftpclient.h and \e ftpclient.cpp, and to add them to the \c HEADERS - and \c SOURCES variables for compilation. + \e simpleftp.h and \e simpleftp.cpp, and to add them appropriately to + the project as headers and sources. \section1 Instantiating the State Machine @@ -88,7 +100,7 @@ \quotefromfile ftpclient/main.cpp \skipto #include - \printuntil ftpdatachannel.h + \printuntil simpleftp \dots \skipto int main \printuntil { diff --git a/examples/scxml/invoke-dynamic/CMakeLists.txt b/examples/scxml/invoke-dynamic/CMakeLists.txt index b1a7fd7..3837e40 100644 --- a/examples/scxml/invoke-dynamic/CMakeLists.txt +++ b/examples/scxml/invoke-dynamic/CMakeLists.txt @@ -15,10 +15,7 @@ endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/scxml/invoke-dynamic") -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Qml) -find_package(Qt6 COMPONENTS Scxml) +find_package(Qt6 COMPONENTS Core Gui Qml Scxml) qt_add_executable(invoke-dynamic invoke-dynamic.cpp @@ -28,13 +25,12 @@ set_target_properties(invoke-dynamic PROPERTIES MACOSX_BUNDLE TRUE ) target_link_libraries(invoke-dynamic PUBLIC - Qt::Core - Qt::Gui - Qt::Qml - Qt::Scxml + Qt6::Core + Qt6::Gui + Qt6::Qml + Qt6::Scxml ) - # Resources: set_source_files_properties("../invoke-common/Button.qml" PROPERTIES QT_RESOURCE_ALIAS "Button.qml" diff --git a/examples/scxml/invoke-dynamic/doc/src/invoke-dynamic.qdoc b/examples/scxml/invoke-dynamic/doc/src/invoke-dynamic.qdoc index bff773a..7a4a63b 100644 --- a/examples/scxml/invoke-dynamic/doc/src/invoke-dynamic.qdoc +++ b/examples/scxml/invoke-dynamic/doc/src/invoke-dynamic.qdoc @@ -53,12 +53,20 @@ \section1 Dynamically Loading the State Machine We link against the Qt SCXML module by adding the following line to the - \e invoke-dynamic.pro file: + project build files. + With qmake to the \e invoke-dynamic.pro \quotefromfile invoke-dynamic/invoke-dynamic.pro \skipto QT \printline scxml + With cmake to the \e CMakeLists.txt + \quotefromfile invoke-dynamic/CMakeLists.txt + \skipto find_package + \printline Scxml + \skipto target_link_libraries + \printuntil ) + We dynamically create the state machine, as follows: \quotefromfile invoke-dynamic/invoke-dynamic.qml diff --git a/examples/scxml/invoke-static/CMakeLists.txt b/examples/scxml/invoke-static/CMakeLists.txt index 93cbda9..640da50 100644 --- a/examples/scxml/invoke-static/CMakeLists.txt +++ b/examples/scxml/invoke-static/CMakeLists.txt @@ -15,10 +15,7 @@ endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/scxml/invoke-static") -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Qml) -find_package(Qt6 COMPONENTS Scxml) +find_package(Qt6 COMPONENTS Core Gui Qml Scxml) qt_add_executable(invoke-static invoke-static.cpp @@ -28,13 +25,12 @@ set_target_properties(invoke-static PROPERTIES MACOSX_BUNDLE TRUE ) target_link_libraries(invoke-static PUBLIC - Qt::Core - Qt::Gui - Qt::Qml - Qt::Scxml + Qt6::Core + Qt6::Gui + Qt6::Qml + Qt6::Scxml ) - # Resources: set_source_files_properties("../invoke-common/Button.qml" PROPERTIES QT_RESOURCE_ALIAS "Button.qml" diff --git a/examples/scxml/invoke-static/doc/src/invoke-static.qdoc b/examples/scxml/invoke-static/doc/src/invoke-static.qdoc index 099b904..7a3a8a2 100644 --- a/examples/scxml/invoke-static/doc/src/invoke-static.qdoc +++ b/examples/scxml/invoke-static/doc/src/invoke-static.qdoc @@ -51,22 +51,34 @@ \printuntil \section1 Compiling the State Machine + We link against the Qt SCXML module by adding the following lines to the + example's build files. - We link against the Qt SCXML module by adding the following line to the - \e invoke-static.pro file: + \section2 \e invoke-static.pro when using qmake: \quotefromfile invoke-static/invoke-static.pro \skipto QT \printline scxml We then specify the state machine to compile: - \skipto STATECHARTS - \printline statemachine + \printline scxml + + \section2 \e CMakeLists.txt when using cmake: + \quotefromfile invoke-static/CMakeLists.txt + \skipto find_package + \printline Scxml + \skipto target_link_libraries + \printuntil ) + + We then specify the state machine to compile: + \skipto qt6_add_statecharts + \printuntil ) - The Qt SCXML Compiler, \c qscxmlc, is run automatically to generate - \e statemachine.h and \e statemachine.cpp, and to add them to the \c HEADERS - and \c SOURCES variables for compilation. + The statechart directives \e STATECHARTS or \e qt6_add_statecharts invoke the Qt SCXML + Compiler, \c qscxmlc, which is run automatically to generate \e statemachine.h and + \e statemachine.cpp, which are then added appropriately as headers and sources for + compilation. \section1 Instantiating the State Machine diff --git a/examples/scxml/mediaplayer-common/doc/src/mediaplayer-compiling.qdocinc b/examples/scxml/mediaplayer-common/doc/src/mediaplayer-compiling.qdocinc index 711a32f..8e8cfbe 100644 --- a/examples/scxml/mediaplayer-common/doc/src/mediaplayer-compiling.qdocinc +++ b/examples/scxml/mediaplayer-common/doc/src/mediaplayer-compiling.qdocinc @@ -1,17 +1,29 @@ \section1 Compiling the State Machine - We link against the Qt SCXML module by adding the following line to the - \e .pro file: + We link against the Qt SCXML module by adding the following lines to the + example's build files. + + \section2 \e .pro when using qmake: \quotefromfile mediaplayer-widgets-static/mediaplayer-widgets-static.pro \skipto QT \printline scxml We then specify the state machine to compile: - \skipto STATECHARTS \printline scxml - The Qt SCXML Compiler, \c qscxmlc, is run automatically to generate - \e statemachine.h and \e statemachine.cpp, and to add them to the \c HEADERS - and \c SOURCES variables for compilation. + \section2 \e CMakeLists.txt when using cmake: + \quotefromfile mediaplayer-widgets-static/CMakeLists.txt + \skipto find_package + \printline Scxml + \skipto target_link_libraries + \printuntil ) + + We then specify the state machine to compile: + \skipto qt6_add_statecharts + \printuntil ) + + The statechart directives \e STATECHARTS or \e qt6_add_statecharts invoke the Qt SCXML + Compiler, \c qscxmlc, which is run automatically to generate a header and a source file, + which are then added appropriately for compilation. diff --git a/examples/scxml/mediaplayer-qml-dynamic/CMakeLists.txt b/examples/scxml/mediaplayer-qml-dynamic/CMakeLists.txt index 910e20d..38f7f92 100644 --- a/examples/scxml/mediaplayer-qml-dynamic/CMakeLists.txt +++ b/examples/scxml/mediaplayer-qml-dynamic/CMakeLists.txt @@ -15,10 +15,7 @@ endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/scxml/mediaplayer-qml-dynamic") -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Qml) -find_package(Qt6 COMPONENTS Scxml) +find_package(Qt6 COMPONENTS Core Gui Qml Scxml) qt_add_executable(mediaplayer-qml-dynamic mediaplayer-qml-dynamic.cpp @@ -28,13 +25,12 @@ set_target_properties(mediaplayer-qml-dynamic PROPERTIES MACOSX_BUNDLE TRUE ) target_link_libraries(mediaplayer-qml-dynamic PUBLIC - Qt::Core - Qt::Gui - Qt::Qml - Qt::Scxml + Qt6::Core + Qt6::Gui + Qt6::Qml + Qt6::Scxml ) - # Resources: set_source_files_properties("../mediaplayer-common/Mediaplayer.qml" PROPERTIES QT_RESOURCE_ALIAS "Mediaplayer.qml" diff --git a/examples/scxml/mediaplayer-qml-dynamic/doc/src/mediaplayer-qml-dynamic.qdoc b/examples/scxml/mediaplayer-qml-dynamic/doc/src/mediaplayer-qml-dynamic.qdoc index 22d3ea2..e981290 100644 --- a/examples/scxml/mediaplayer-qml-dynamic/doc/src/mediaplayer-qml-dynamic.qdoc +++ b/examples/scxml/mediaplayer-qml-dynamic/doc/src/mediaplayer-qml-dynamic.qdoc @@ -47,14 +47,23 @@ \section1 Dynamically Loading the State Machine We link against the Qt SCXML module by adding the following line to the - example \e .pro file: + project build files. + + With qmake to the \e mediaplayer-qml-dynamic.pro \quotefromfile mediaplayer-qml-dynamic/mediaplayer-qml-dynamic.pro \skipto QT \printline scxml + With cmake to the \e CMakeLists.txt + \quotefromfile mediaplayer-qml-dynamic/CMakeLists.txt + \skipto find_package + \printline Scxml + \skipto target_link_libraries + \printuntil ) + We dynamically create the state machine in - \e mediaplayer-common\Mediaplayer.qml: + \e {mediaplayer-common\\Mediaplayer.qml:} \quotefromfile mediaplayer-common/Mediaplayer.qml \skipto import QtScxml diff --git a/examples/scxml/mediaplayer-widgets-dynamic/CMakeLists.txt b/examples/scxml/mediaplayer-widgets-dynamic/CMakeLists.txt index 775142a..128549b 100644 --- a/examples/scxml/mediaplayer-widgets-dynamic/CMakeLists.txt +++ b/examples/scxml/mediaplayer-widgets-dynamic/CMakeLists.txt @@ -15,10 +15,7 @@ endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/scxml/mediaplayer-widgets-dynamic") -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Widgets) -find_package(Qt6 COMPONENTS Scxml) +find_package(Qt6 COMPONENTS Core Gui Widgets Scxml) qt_add_executable(mediaplayer-widgets-dynamic ../mediaplayer-common/mainwindow.cpp ../mediaplayer-common/mainwindow.h ../mediaplayer-common/mainwindow.ui @@ -29,13 +26,12 @@ set_target_properties(mediaplayer-widgets-dynamic PROPERTIES MACOSX_BUNDLE TRUE ) target_link_libraries(mediaplayer-widgets-dynamic PUBLIC - Qt::Core - Qt::Gui - Qt::Scxml - Qt::Widgets + Qt6::Core + Qt6::Gui + Qt6::Scxml + Qt6::Widgets ) - # Resources: set_source_files_properties("../mediaplayer-common/mediaplayer.scxml" PROPERTIES QT_RESOURCE_ALIAS "mediaplayer.scxml" diff --git a/examples/scxml/mediaplayer-widgets-dynamic/doc/src/mediaplayer-widgets-dynamic.qdoc b/examples/scxml/mediaplayer-widgets-dynamic/doc/src/mediaplayer-widgets-dynamic.qdoc index 59ec84f..51d4b95 100644 --- a/examples/scxml/mediaplayer-widgets-dynamic/doc/src/mediaplayer-widgets-dynamic.qdoc +++ b/examples/scxml/mediaplayer-widgets-dynamic/doc/src/mediaplayer-widgets-dynamic.qdoc @@ -47,11 +47,20 @@ \section1 Dynamically Loading the State Machine We link against the Qt SCXML module by adding the following line to the - example \e .pro file: + project build files. + + With qmake to the \e mediaplayer-widgets-dynamic.pro \quotefromfile mediaplayer-widgets-dynamic/mediaplayer-widgets-dynamic.pro \skipto QT - \printuntil scxml + \printline scxml + + With cmake to the \e CMakeLists.txt + \quotefromfile mediaplayer-widgets-dynamic/CMakeLists.txt + \skipto find_package + \printline Scxml + \skipto target_link_libraries + \printuntil ) \quotefromfile mediaplayer-widgets-dynamic/mediaplayer-widgets-dynamic.cpp diff --git a/examples/scxml/mediaplayer-widgets-static/CMakeLists.txt b/examples/scxml/mediaplayer-widgets-static/CMakeLists.txt index e143592..3a95fc0 100644 --- a/examples/scxml/mediaplayer-widgets-static/CMakeLists.txt +++ b/examples/scxml/mediaplayer-widgets-static/CMakeLists.txt @@ -15,10 +15,7 @@ endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/scxml/mediaplayer-widgets-static") -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Widgets) -find_package(Qt6 COMPONENTS Scxml) +find_package(Qt6 COMPONENTS Core Gui Widgets Scxml) qt_add_executable(mediaplayer-widgets-static ../mediaplayer-common/mainwindow.cpp ../mediaplayer-common/mainwindow.h ../mediaplayer-common/mainwindow.ui @@ -29,13 +26,12 @@ set_target_properties(mediaplayer-widgets-static PROPERTIES MACOSX_BUNDLE TRUE ) target_link_libraries(mediaplayer-widgets-static PUBLIC - Qt::Core - Qt::Gui - Qt::Scxml - Qt::Widgets + Qt6::Core + Qt6::Gui + Qt6::Scxml + Qt6::Widgets ) - # Statecharts: qt6_add_statecharts(mediaplayer-widgets-static ../mediaplayer-common/mediaplayer.scxml diff --git a/examples/scxml/trafficlight-common/doc/src/trafficlight-compiling.qdocinc b/examples/scxml/trafficlight-common/doc/src/trafficlight-compiling.qdocinc index ac16203..1410dcb 100644 --- a/examples/scxml/trafficlight-common/doc/src/trafficlight-compiling.qdocinc +++ b/examples/scxml/trafficlight-common/doc/src/trafficlight-compiling.qdocinc @@ -1,17 +1,30 @@ \section1 Compiling the State Machine - We link against the Qt SCXML module by adding the following line to the - \e .pro file: + We link against the Qt SCXML module by adding the following lines to the + example's build files. + + \section2 \e .pro when using qmake: \quotefromfile trafficlight-qml-static/trafficlight-qml-static.pro \skipto QT \printline scxml We then specify the state machine to compile: - \skipto STATECHARTS \printline scxml - The Qt SCXML Compiler, \c qscxmlc, is run automatically to generate - \e statemachine.h and \e statemachine.cpp, and to add them to the \c HEADERS - and \c SOURCES variables for compilation. + \section2 \e CMakeLists.txt when using cmake: + \quotefromfile trafficlight-qml-static/CMakeLists.txt + \skipto find_package + \printline Scxml + \skipto target_link_libraries + \printuntil ) + + We then specify the state machine to compile: + \skipto qt6_add_statecharts + \printuntil ) + + The statechart directives \e STATECHARTS or \e qt6_add_statecharts invoke the Qt SCXML + Compiler, \c qscxmlc, which is run automatically to generate \e statemachine.h and + \e statemachine.cpp, which are then added appropriately as headers and sources for + compilation. diff --git a/examples/scxml/trafficlight-qml-dynamic/CMakeLists.txt b/examples/scxml/trafficlight-qml-dynamic/CMakeLists.txt index 20ab198..fd4a5a6 100644 --- a/examples/scxml/trafficlight-qml-dynamic/CMakeLists.txt +++ b/examples/scxml/trafficlight-qml-dynamic/CMakeLists.txt @@ -15,10 +15,7 @@ endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/scxml/trafficlight-qml-dynamic") -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Qml) -find_package(Qt6 COMPONENTS Scxml) +find_package(Qt6 COMPONENTS Core Gui Qml Scxml) qt_add_executable(trafficlight-qml-dynamic trafficlight-qml-dynamic.cpp @@ -28,10 +25,10 @@ set_target_properties(trafficlight-qml-dynamic PROPERTIES MACOSX_BUNDLE TRUE ) target_link_libraries(trafficlight-qml-dynamic PUBLIC - Qt::Core - Qt::Gui - Qt::Qml - Qt::Scxml + Qt6::Core + Qt6::Gui + Qt6::Qml + Qt6::Scxml ) 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 0316508..56e4dc4 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 @@ -44,13 +44,21 @@ \section1 Dynamically Loading the State Machine - We link against the Qt SCXML module by adding the following line to the - example \e .pro file: + We link against the Qt SCXML module by adding the following lines to the + example's build files. + To \e .pro when using qmake: \quotefromfile trafficlight-qml-dynamic/trafficlight-qml-dynamic.pro \skipto QT \printline scxml + To \e CMakeLists.txt when using cmake: + \quotefromfile trafficlight-qml-dynamic/CMakeLists.txt + \skipto find_package + \printline Scxml + \skipto target_link_libraries + \printuntil ) + We dynamically create the state machine in the main QML file: \quotefromfile trafficlight-qml-dynamic/trafficlight-qml-dynamic.qml diff --git a/examples/scxml/trafficlight-qml-static/CMakeLists.txt b/examples/scxml/trafficlight-qml-static/CMakeLists.txt index a61e14e..9747461 100644 --- a/examples/scxml/trafficlight-qml-static/CMakeLists.txt +++ b/examples/scxml/trafficlight-qml-static/CMakeLists.txt @@ -15,10 +15,7 @@ endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/scxml/trafficlight-qml-static") -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Qml) -find_package(Qt6 COMPONENTS Scxml) +find_package(Qt6 COMPONENTS Core Gui Qml Scxml) qt_add_executable(trafficlight-qml-static trafficlight-qml-static.cpp @@ -28,10 +25,10 @@ set_target_properties(trafficlight-qml-static PROPERTIES MACOSX_BUNDLE TRUE ) target_link_libraries(trafficlight-qml-static PUBLIC - Qt::Core - Qt::Gui - Qt::Qml - Qt::Scxml + Qt6::Core + Qt6::Gui + Qt6::Qml + Qt6::Scxml ) diff --git a/examples/scxml/trafficlight-widgets-dynamic/CMakeLists.txt b/examples/scxml/trafficlight-widgets-dynamic/CMakeLists.txt index 1cdd7e6..c860c0d 100644 --- a/examples/scxml/trafficlight-widgets-dynamic/CMakeLists.txt +++ b/examples/scxml/trafficlight-widgets-dynamic/CMakeLists.txt @@ -15,10 +15,7 @@ endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/scxml/trafficlight-widgets-dynamic") -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Widgets) -find_package(Qt6 COMPONENTS Scxml) +find_package(Qt6 COMPONENTS Core Gui Widgets Scxml) qt_add_executable(trafficlight-widgets-dynamic ../trafficlight-common/trafficlight.cpp ../trafficlight-common/trafficlight.h @@ -29,10 +26,10 @@ set_target_properties(trafficlight-widgets-dynamic PROPERTIES MACOSX_BUNDLE TRUE ) target_link_libraries(trafficlight-widgets-dynamic PUBLIC - Qt::Core - Qt::Gui - Qt::Scxml - Qt::Widgets + Qt6::Core + Qt6::Gui + Qt6::Scxml + Qt6::Widgets ) 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 de37ae0..ecf7d91 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 @@ -44,13 +44,21 @@ \section1 Dynamically Loading the State Machine - We link against the Qt SCXML module by adding the following line to the - example \e .pro file: + We link against the Qt SCXML module by adding the following lines to the + example's build files. + To \e .pro when using qmake: \quotefromfile trafficlight-widgets-dynamic/trafficlight-widgets-dynamic.pro \skipto QT \printline scxml + To \e CMakeLists.txt when using cmake: + \quotefromfile trafficlight-widgets-dynamic/CMakeLists.txt + \skipto find_package + \printline Scxml + \skipto target_link_libraries + \printuntil ) + We dynamically create the state machine in \e trafficlight-widgets-dynamic.cpp: diff --git a/src/scxml/doc/qt6-changes.qdoc b/src/scxml/doc/qt6-changes.qdoc new file mode 100644 index 0000000..13c0fb6 --- /dev/null +++ b/src/scxml/doc/qt6-changes.qdoc @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qtscxml-changes-qt6.html + \title Changes to Qt SCXML + \ingroup changes-qt-5-to-6 + \brief Migrate Qt SCXML to Qt 6. + + Qt 6 is a result of the conscious effort to make the framework more + efficient and easy to use. + + We try to maintain binary and source compatibility for all the public + APIs in each release. But some changes were inevitable in an effort to + make Qt a better framework. + + In this topic we summarize those changes in Qt SCXML module, and provide + guidance to handle them. + + \section1 Changes overview + + The Qt SCXML module is generally speaking source compatible with the Qt5 + version and users of the library should be able to continue with no or + minor changes to their project. + + \section1 Build system + + As with Qt6 in general, the Qt SCXML module has cmake support in addition + to qmake. + + \section1 QML imports + + The QML import versioning is optional unless one has a specific + reason for not using the latest. Generally speaking the versioned imports + work from version 5.8 to 6.x, where 'x' is the current minor release. +*/ diff --git a/src/scxml/doc/qtscxml-index.qdoc b/src/scxml/doc/qtscxml-index.qdoc index e129788..1cfd9f9 100644 --- a/src/scxml/doc/qtscxml-index.qdoc +++ b/src/scxml/doc/qtscxml-index.qdoc @@ -52,11 +52,13 @@ import QtScxml \endqml - To link against the module, add this line to your qmake .pro file: + To link against the module: - \code - QT += scxml - \endcode + Using cmake: + \include qtscxml-module-use.qdocinc cmakebuild + + Using qmake: + \include qtscxml-module-use.qdocinc qmakebuild \section1 Articles and Guides diff --git a/src/scxml/doc/qtscxml-instantiating-state-machines.qdoc b/src/scxml/doc/qtscxml-instantiating-state-machines.qdoc index 662bbac..32710e7 100644 --- a/src/scxml/doc/qtscxml-instantiating-state-machines.qdoc +++ b/src/scxml/doc/qtscxml-instantiating-state-machines.qdoc @@ -84,20 +84,26 @@ } \endqml - To compile a state machine, the following lines have to be added to a - .pro file: + To compile a state machine, the following lines have to be added to the + project build file: - \badcode - QT += scxml - STATECHARTS = MyStatemachine.scxml - \endcode + When using cmake: + + \include qtscxml-module-use.qdocinc cmakebuild + \include qtscxml-module-use.qdocinc cmakestatecharts + + When using qmake: + + \include qtscxml-module-use.qdocinc qmakebuild + \include qtscxml-module-use.qdocinc qmakestatecharts This will tell qmake to run \e qscxmlc which generates MyStatemachine.h - and MyStatemachine.cpp, and adds them to \l [QMake] HEADERS and - \l [QMake] SOURCES variables. By default, the generated files are saved in - the build directory. The \e QSCXMLC_DIR variable can be set to specify - another directory. The \e QSCXMLC_NAMESPACE variable can be set to put the - state machine code into a C++ namespace. + and MyStatemachine.cpp, and adds them to appropriately to the project + headers and sources. By default, the generated files are saved in + the build directory. The qmake \e QSCXMLC_DIR or cmake \e OUTPUT_DIR variable + can be set to specify another directory. The qmake \e QSCXMLC_NAMESPACE + or cmake \e NAMESPACE variable can be set to put the state machine code into a + C++ namespace. After instantiating a state machine, you can connect to any state's active property as follows. For example, if the state machine for a diff --git a/src/scxml/doc/qtscxml-module-cpp.qdoc b/src/scxml/doc/qtscxml-module-cpp.qdoc index 88002ca..bf92411 100644 --- a/src/scxml/doc/qtscxml-module-cpp.qdoc +++ b/src/scxml/doc/qtscxml-module-cpp.qdoc @@ -33,6 +33,7 @@ \ingroup modules \ingroup technology-apis \qtvariable scxml + \qtcmakepackage Scxml To include the definitions of the module's classes, use the following directive: @@ -40,11 +41,13 @@ #include <QScxmlStateMachine> \endcode - To link against the module, add this line to your qmake .pro file: + To use the module with cmake, use the \c{find_package()} command to locate the + needed module components in the \c{Qt6} package: + \include qtscxml-module-use.qdocinc cmakebuild - \code - QT += scxml - \endcode + To configure the module for building with qmake, add the module as a value + of the \c QT variable in the project's .pro file: + \include qtscxml-module-use.qdocinc qmakebuild For more information, see \l{Instantiating State Machines}. */ diff --git a/src/scxml/doc/qtscxml-module-use.qdocinc b/src/scxml/doc/qtscxml-module-use.qdocinc new file mode 100644 index 0000000..c8a587e --- /dev/null +++ b/src/scxml/doc/qtscxml-module-use.qdocinc @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [cmakebuild] + \code + find_package(Qt6 COMPONENTS Scxml REQUIRED) + target_link_libraries(mytarget PRIVATE Qt6::Scxml) + \endcode +//! [cmakebuild] + +//! [qmakebuild] + \code + QT += scxml + \endcode +//! [qmakebuild] + +//! [qmakestatecharts] + \code + STATECHARTS = MyStatemachine.scxml + \endcode +//! [qmakestatecharts] + +//! [cmakestatecharts] + \code + qt6_add_statecharts(mytarget + MyStatemachine.scxml + ) + \endcode +//! [cmakestatecharts] + diff --git a/src/scxml/doc/qtscxml-overview.qdoc b/src/scxml/doc/qtscxml-overview.qdoc index dfecb0a..11b762c 100644 --- a/src/scxml/doc/qtscxml-overview.qdoc +++ b/src/scxml/doc/qtscxml-overview.qdoc @@ -41,7 +41,7 @@ and the user interface implementation by using Qt Quick or Qt Widgets. The Qt SCXML module differs from the \l {The State Machine Framework} - {State Machine framework} in the Qt Core module in that Qt SCXML provides a + {State Machine framework} in the Qt StateMachine module in that Qt SCXML provides a \e {conforming processor} that can parse and process \e {conforming SCXML documents}. In Qt SCXML, state machines are read from separate SCXML files and integrated to Qt applications by instantiating the QScxmlStateMachine diff --git a/src/scxml/doc/qtscxml.qdocconf b/src/scxml/doc/qtscxml.qdocconf index 6d90bd1..b753837 100644 --- a/src/scxml/doc/qtscxml.qdocconf +++ b/src/scxml/doc/qtscxml.qdocconf @@ -5,12 +5,9 @@ project = QtScxml description = Qt Scxml Reference Documentation version = $QT_VERSION -# Install path for the examples. For Qt 5.6, the convention -# is to use the repository name as the install location -# under QT_INSTALL_EXAMPLES. +# Install path for the examples examplesinstallpath = scxml exampledirs = ../../../examples/scxml -imagedirs = ../../../examples/doc/images examples.fileextensions += "*.scxml" diff --git a/src/scxml/qscxmlcppdatamodel.cpp b/src/scxml/qscxmlcppdatamodel.cpp index 88289ad..859f98f 100644 --- a/src/scxml/qscxmlcppdatamodel.cpp +++ b/src/scxml/qscxmlcppdatamodel.cpp @@ -64,7 +64,7 @@ using namespace QScxmlExecutableContent; The format of the \e datamodel attribute is: \c{cplusplus:<class-name>:<classdef-header>}. So, for the example above, there should be a file \e thedatamodel.h containing a subclass of QScxmlCppDataModel, containing at least the following: - \code + \badcode #include "qscxmlcppdatamodel.h" class TheDataModel: public QScxmlCppDataModel @@ -74,7 +74,7 @@ class TheDataModel: public QScxmlCppDataModel }; \endcode The Q_SCXML_DATAMODEL has to appear in the private section of the class definition, for example - right after the opening bracket, or after a \Q_OBJECT macro. + right after the opening bracket, or after a Q_OBJECT macro. This macro expands to the declaration of some virtual methods whose implementation is generated by the Qt SCXML compiler. @@ -138,6 +138,8 @@ QScxmlCppDataModel::QScxmlCppDataModel(QObject *parent) * for data model variables specified by their keys, \a initialDataValues. These * are the values specified by \c <param> tags in an \c <invoke> element. * + * Returns \c true on success. + * * \sa QScxmlStateMachine::init */ bool QScxmlCppDataModel::setup(const QVariantMap &initialDataValues) diff --git a/src/scxml/qscxmlstatemachine.cpp b/src/scxml/qscxmlstatemachine.cpp index 8a0ed25..a875a53 100644 --- a/src/scxml/qscxmlstatemachine.cpp +++ b/src/scxml/qscxmlstatemachine.cpp @@ -200,7 +200,7 @@ Q_LOGGING_CATEGORY(scxmlLog, "scxml.statemachine") */ /*! - \fn std::function<void(bool)> QScxmlStateMachine::onEntry( + \fn [onentry] std::function<void(bool)> QScxmlStateMachine::onEntry( const QObject *receiver, const char *method) Returns a functor that accepts a boolean argument and calls the given @@ -215,7 +215,7 @@ Q_LOGGING_CATEGORY(scxmlLog, "scxml.statemachine") */ /*! - \fn std::function<void(bool)> QScxmlStateMachine::onExit( + \fn [onexit] std::function<void(bool)> QScxmlStateMachine::onExit( const QObject *receiver, const char *method) Returns a functor that accepts a boolean argument and calls the given @@ -230,7 +230,7 @@ Q_LOGGING_CATEGORY(scxmlLog, "scxml.statemachine") */ /*! - \fn template<typename Functor> std::function<void(bool)> QScxmlStateMachine::onEntry( + \fn [onentry-functor] template<typename Functor> std::function<void(bool)> QScxmlStateMachine::onEntry( Functor functor) Returns a functor that accepts a boolean argument and calls the given @@ -242,7 +242,7 @@ Q_LOGGING_CATEGORY(scxmlLog, "scxml.statemachine") */ /*! - \fn template<typename Functor> std::function<void(bool)> QScxmlStateMachine::onExit(Functor functor) + \fn [onexit-functor] template<typename Functor> std::function<void(bool)> QScxmlStateMachine::onExit(Functor functor) Returns a functor that accepts a boolean argument and calls the given \a functor if that argument is \c false. The given \a functor must not @@ -253,7 +253,7 @@ Q_LOGGING_CATEGORY(scxmlLog, "scxml.statemachine") */ /*! - \fn template<typename PointerToMemberFunction> std::function<void(bool)> QScxmlStateMachine::onEntry( + \fn [onentry-template] template<typename PointerToMemberFunction> std::function<void(bool)> QScxmlStateMachine::onEntry( const typename QtPrivate::FunctionPointer<PointerToMemberFunction>::Object *receiver, PointerToMemberFunction method) @@ -267,7 +267,7 @@ Q_LOGGING_CATEGORY(scxmlLog, "scxml.statemachine") */ /*! - \fn template<typename PointerToMemberFunction> std::function<void(bool)> QScxmlStateMachine::onExit( + \fn [onexit-template] template<typename PointerToMemberFunction> std::function<void(bool)> QScxmlStateMachine::onExit( const typename QtPrivate::FunctionPointer<PointerToMemberFunction>::Object *receiver, PointerToMemberFunction method) diff --git a/src/scxml/qscxmlstatemachine.h b/src/scxml/qscxmlstatemachine.h index fbcbf12..45e6b74 100644 --- a/src/scxml/qscxmlstatemachine.h +++ b/src/scxml/qscxmlstatemachine.h @@ -156,6 +156,7 @@ public: slotObj, type); } + //! [onentry] static std::function<void(bool)> onEntry(const QObject *receiver, const char *method) { const QPointer<QObject> receiverPointer(const_cast<QObject *>(receiver)); @@ -165,6 +166,7 @@ public: }; } + //! [onexit] static std::function<void(bool)> onExit(const QObject *receiver, const char *method) { const QPointer<QObject> receiverPointer(const_cast<QObject *>(receiver)); @@ -174,6 +176,7 @@ public: }; } + //! [onentry-functor] template<typename Functor> static std::function<void(bool)> onEntry(Functor functor) { @@ -183,6 +186,7 @@ public: }; } + //! [onexit-functor] template<typename Functor> static std::function<void(bool)> onExit(Functor functor) { @@ -192,6 +196,7 @@ public: }; } + //! [onentry-template] template<typename PointerToMemberFunction> static std::function<void(bool)> onEntry( const typename QtPrivate::FunctionPointer<PointerToMemberFunction>::Object *receiver, @@ -205,6 +210,7 @@ public: }; } + //! [onexit-template] template<typename PointerToMemberFunction> static std::function<void(bool)> onExit( const typename QtPrivate::FunctionPointer<PointerToMemberFunction>::Object *receiver, diff --git a/tools/qscxmlc/doc/qscxmlc.qdoc b/tools/qscxmlc/doc/qscxmlc.qdoc index bf38a63..20c9c6b 100644 --- a/tools/qscxmlc/doc/qscxmlc.qdoc +++ b/tools/qscxmlc/doc/qscxmlc.qdoc @@ -39,18 +39,23 @@ \section1 Usage - The \c qscxml tool is invoked automatically if the QT variable in the - project file includes \c scxml, and the .scxml file to use is specified - using the \c STATECHARTS variable. + The \c qscxmlc tool is invoked automatically if the project is linked against + the \c scxml library in the project file, and the \c .scxml file to use is specified + using the special build directives \c STATECHARTS or qt6_add_statecharts. - \badcode - QT += scxml - STATECHARTS = MyStatemachine.scxml - \endcode + When using cmake: - With above definitions, \c qmake invokes \c qscxmlc to generate - MyStatemachine.h and MyStatemachine.cpp, and adds them to \l [QMake] - HEADERS and \l [QMAKE] SOURCES variables. + \include qtscxml-module-use.qdocinc cmakebuild + \include qtscxml-module-use.qdocinc cmakestatecharts + + When using qmake: + + \include qtscxml-module-use.qdocinc qmakebuild + \include qtscxml-module-use.qdocinc qmakestatecharts + + With above definitions, \c qmake or \c cmake invokes \c qscxmlc to generate + MyStatemachine.h and MyStatemachine.cpp, and adds them appropriately + to the project as headers and sources. By default, the name of the generated class that implements the state machine corresponds with the \e name attribute of the \c <scxml> root |