diff options
author | Juha Vuolle <juha.vuolle@qt.io> | 2023-02-20 14:34:51 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-02-23 06:39:01 +0000 |
commit | ac0e56806c61feae8662c60db66060ce567e0eb9 (patch) | |
tree | 34afcc5512c5ef771036aaedbedb53b9caea536a | |
parent | 8dbfad334fd56356d6190a0e645f974567c90183 (diff) |
Remove invoke-dynamic example and rename invoke-static to plain "invoke"
The primary purpose of the example is to demonstrate invoking, and
one example variant is probably adequate.
Task-number: QTBUG-111090
Change-Id: I1f8a64be3bb82c9663687b7f37cf6682e0626060
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit a21673b4315f9fce913a9c7bc513102874e6777f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
23 files changed, 91 insertions, 278 deletions
diff --git a/examples/scxml/CMakeLists.txt b/examples/scxml/CMakeLists.txt index 257fe22..3257421 100644 --- a/examples/scxml/CMakeLists.txt +++ b/examples/scxml/CMakeLists.txt @@ -20,6 +20,5 @@ if(TARGET Qt::Qml AND TARGET Qt::Gui) qt_internal_add_example(trafficlight-qml-dynamic) qt_internal_add_example(trafficlight-qml-simple) qt_internal_add_example(mediaplayer) - qt_internal_add_example(invoke-static) - qt_internal_add_example(invoke-dynamic) + qt_internal_add_example(invoke) endif() diff --git a/examples/scxml/invoke-dynamic/CMakeLists.txt b/examples/scxml/invoke-dynamic/CMakeLists.txt deleted file mode 100644 index 25cd67f..0000000 --- a/examples/scxml/invoke-dynamic/CMakeLists.txt +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: BSD-3-Clause - -cmake_minimum_required(VERSION 3.16) -project(invoke-dynamic LANGUAGES CXX) - -set(CMAKE_AUTOMOC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/scxml/invoke-dynamic") - -find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Scxml) - -qt_add_executable(invoke-dynamic - invoke-dynamic.cpp -) - -set_target_properties(invoke-dynamic PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(invoke-dynamic PUBLIC - Qt6::Core - Qt6::Gui - Qt6::Qml - Qt6::Scxml -) - -# Resources: -set_source_files_properties("../invoke-common/Button.qml" - PROPERTIES QT_RESOURCE_ALIAS "Button.qml" -) - -set_source_files_properties("../invoke-common/MainView.qml" - PROPERTIES QT_RESOURCE_ALIAS "MainView.qml" -) - -set_source_files_properties("../invoke-common/SubView.qml" - PROPERTIES QT_RESOURCE_ALIAS "SubView.qml" -) - -set_source_files_properties("../invoke-common/statemachine.scxml" - PROPERTIES QT_RESOURCE_ALIAS "statemachine.scxml" -) - -set(invoke-dynamic_resource_files - "../invoke-common/Button.qml" - "../invoke-common/MainView.qml" - "../invoke-common/SubView.qml" - "../invoke-common/statemachine.scxml" - "invoke-dynamic.qml" -) - -qt6_add_resources(invoke-dynamic "invoke-dynamic" - PREFIX - "/" - FILES - ${invoke-dynamic_resource_files} -) - -install(TARGETS invoke-dynamic - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/scxml/invoke-dynamic/doc/images/invoke-dynamic.png b/examples/scxml/invoke-dynamic/doc/images/invoke-dynamic.png Binary files differdeleted file mode 100644 index 4efa912..0000000 --- a/examples/scxml/invoke-dynamic/doc/images/invoke-dynamic.png +++ /dev/null diff --git a/examples/scxml/invoke-dynamic/doc/src/invoke-dynamic.qdoc b/examples/scxml/invoke-dynamic/doc/src/invoke-dynamic.qdoc deleted file mode 100644 index 76560ea..0000000 --- a/examples/scxml/invoke-dynamic/doc/src/invoke-dynamic.qdoc +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only - -/*! - \example invoke-dynamic - \title Qt SCXML Invoke Example (Dynamic) - \ingroup examples-qtscxml - - \brief Invokes a dynamically loaded nested state machine. - - \image invoke-dynamic.png - - \e{Invoke Example (Dynamic)} demonstrates how to use the \c <invoke> element - with generated nested state-machines, where the SCXML file is dynamically - loaded. The \c <invoke> element is used to create an instance of an external - service. - - \include examples-run.qdocinc - - \section1 Invoking the State Machine - - In \e statemachine.scxml, we specify a state machine with the name - \e Directions of type \e http://www.w3.org/TR/scxml/ to invoke: - - \quotefromfile invoke-common/statemachine.scxml - \skipto scxml - \printuntil - - \section1 Dynamically Loading the State Machine - - We link against the Qt SCXML module by adding the following line to the - 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 - \skipto import - \printuntil } -*/ diff --git a/examples/scxml/invoke-dynamic/invoke-dynamic.cpp b/examples/scxml/invoke-dynamic/invoke-dynamic.cpp deleted file mode 100644 index 93388fc..0000000 --- a/examples/scxml/invoke-dynamic/invoke-dynamic.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QQmlContext> - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/invoke-dynamic.qml"))); - if (engine.rootObjects().isEmpty()) - return -1; - - return app.exec(); -} diff --git a/examples/scxml/invoke-dynamic/invoke-dynamic.pro b/examples/scxml/invoke-dynamic/invoke-dynamic.pro deleted file mode 100644 index e4f07da..0000000 --- a/examples/scxml/invoke-dynamic/invoke-dynamic.pro +++ /dev/null @@ -1,12 +0,0 @@ -TEMPLATE = app - -QT += qml scxml -CONFIG += c++11 - -SOURCES += invoke-dynamic.cpp - -RESOURCES += invoke-dynamic.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/scxml/invoke-dynamic -INSTALLS += target - diff --git a/examples/scxml/invoke-dynamic/invoke-dynamic.qml b/examples/scxml/invoke-dynamic/invoke-dynamic.qml deleted file mode 100644 index a9c823d..0000000 --- a/examples/scxml/invoke-dynamic/invoke-dynamic.qml +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -import QtScxml - -MainView { - stateMachine: directions.stateMachine - - StateMachineLoader { - id: directions - source: "qrc:///statemachine.scxml" - } -} diff --git a/examples/scxml/invoke-dynamic/invoke-dynamic.qrc b/examples/scxml/invoke-dynamic/invoke-dynamic.qrc deleted file mode 100644 index ecf8bd1..0000000 --- a/examples/scxml/invoke-dynamic/invoke-dynamic.qrc +++ /dev/null @@ -1,9 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>invoke-dynamic.qml</file> - <file alias="statemachine.scxml">../invoke-common/statemachine.scxml</file> - <file alias="MainView.qml">../invoke-common/MainView.qml</file> - <file alias="SubView.qml">../invoke-common/SubView.qml</file> - <file alias="Button.qml">../invoke-common/Button.qml</file> - </qresource> -</RCC> diff --git a/examples/scxml/invoke-static/CMakeLists.txt b/examples/scxml/invoke-static/CMakeLists.txt deleted file mode 100644 index 4ffea42..0000000 --- a/examples/scxml/invoke-static/CMakeLists.txt +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: BSD-3-Clause - -cmake_minimum_required(VERSION 3.16) -project(invoke-static LANGUAGES CXX) - -set(CMAKE_AUTOMOC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/scxml/invoke-static") - -find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Scxml) - -qt_add_executable(invoke-static - invoke-static.cpp -) - -set_target_properties(invoke-static PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(invoke-static PUBLIC - Qt6::Core - Qt6::Gui - Qt6::Qml - Qt6::Scxml -) - -# Resources: -set_source_files_properties("../invoke-common/Button.qml" - PROPERTIES QT_RESOURCE_ALIAS "Button.qml" -) - -set_source_files_properties("../invoke-common/MainView.qml" - PROPERTIES QT_RESOURCE_ALIAS "MainView.qml" -) - -set_source_files_properties("../invoke-common/SubView.qml" - PROPERTIES QT_RESOURCE_ALIAS "SubView.qml" -) - -set(invoke-static_resource_files - "../invoke-common/Button.qml" - "../invoke-common/MainView.qml" - "../invoke-common/SubView.qml" - "invoke-static.qml" -) - -qt6_add_resources(invoke-static "invoke-static" - PREFIX - "/" - FILES - ${invoke-static_resource_files} -) - -# Statecharts: -qt6_add_statecharts(invoke-static - ../invoke-common/statemachine.scxml -) - -install(TARGETS invoke-static - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/scxml/invoke-static/invoke-static.pro b/examples/scxml/invoke-static/invoke-static.pro deleted file mode 100644 index e2e206c..0000000 --- a/examples/scxml/invoke-static/invoke-static.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = app - -QT += qml scxml -CONFIG += c++11 - -SOURCES += invoke-static.cpp - -RESOURCES += invoke-static.qrc - -STATECHARTS = ../invoke-common/statemachine.scxml - -target.path = $$[QT_INSTALL_EXAMPLES]/scxml/invoke-static -INSTALLS += target - diff --git a/examples/scxml/invoke-static/invoke-static.qrc b/examples/scxml/invoke-static/invoke-static.qrc deleted file mode 100644 index cc5bcad..0000000 --- a/examples/scxml/invoke-static/invoke-static.qrc +++ /dev/null @@ -1,8 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>invoke-static.qml</file> - <file alias="MainView.qml">../invoke-common/MainView.qml</file> - <file alias="SubView.qml">../invoke-common/SubView.qml</file> - <file alias="Button.qml">../invoke-common/Button.qml</file> - </qresource> -</RCC> diff --git a/examples/scxml/invoke-common/Button.qml b/examples/scxml/invoke/Button.qml index 0b7e6b2..0b7e6b2 100644 --- a/examples/scxml/invoke-common/Button.qml +++ b/examples/scxml/invoke/Button.qml diff --git a/examples/scxml/invoke/CMakeLists.txt b/examples/scxml/invoke/CMakeLists.txt new file mode 100644 index 0000000..93bbf58 --- /dev/null +++ b/examples/scxml/invoke/CMakeLists.txt @@ -0,0 +1,56 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +cmake_minimum_required(VERSION 3.16) +project(invoke LANGUAGES CXX) + +set(CMAKE_AUTOMOC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/scxml/invoke") + +find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Scxml) + +qt_add_executable(invoke + invoke.cpp +) + +set_target_properties(invoke PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) + +target_link_libraries(invoke PUBLIC + Qt6::Core + Qt6::Gui + Qt6::Qml + Qt6::Scxml +) + +set(invoke_resource_files + "Button.qml" + "MainView.qml" + "SubView.qml" + "invoke.qml" +) + +qt6_add_resources(invoke "invoke" + PREFIX + "/" + FILES + ${invoke_resource_files} +) + +# Statecharts: +qt6_add_statecharts(invoke + statemachine.scxml +) + +install(TARGETS invoke + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/scxml/invoke-common/MainView.qml b/examples/scxml/invoke/MainView.qml index 6ae5155..6ae5155 100644 --- a/examples/scxml/invoke-common/MainView.qml +++ b/examples/scxml/invoke/MainView.qml diff --git a/examples/scxml/invoke-common/SubView.qml b/examples/scxml/invoke/SubView.qml index 413227b..413227b 100644 --- a/examples/scxml/invoke-common/SubView.qml +++ b/examples/scxml/invoke/SubView.qml diff --git a/examples/scxml/invoke-static/doc/images/invoke-static.png b/examples/scxml/invoke/doc/images/invoke.png Binary files differindex fa73ebe..fa73ebe 100644 --- a/examples/scxml/invoke-static/doc/images/invoke-static.png +++ b/examples/scxml/invoke/doc/images/invoke.png diff --git a/examples/scxml/invoke-static/doc/src/invoke-static.qdoc b/examples/scxml/invoke/doc/src/invoke.qdoc index 2714dd1..8c1ff95 100644 --- a/examples/scxml/invoke-static/doc/src/invoke-static.qdoc +++ b/examples/scxml/invoke/doc/src/invoke.qdoc @@ -2,15 +2,15 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! - \example invoke-static - \title Qt SCXML Invoke Example (Static) + \example invoke + \title Qt SCXML Invoke Example \ingroup examples-qtscxml \brief Invokes a compiled nested state machine. - \image invoke-static.png + \image invoke.png - \e{Invoke Example (Static)} demonstrates how to use the \c <invoke> element + \e{Invoke Example} demonstrates how to use the \c <invoke> element with generated nested state-machines, where the SCXML file is compiled to a C++ class. The \c <invoke> element is used to create an instance of an external service. @@ -22,7 +22,7 @@ In \e statemachine.scxml, we specify a state machine with the name \e Directions of type \e http://www.w3.org/TR/scxml/ to invoke: - \quotefromfile invoke-common/statemachine.scxml + \quotefromfile invoke/statemachine.scxml \skipto scxml \printuntil @@ -30,9 +30,9 @@ We link against the Qt SCXML module by adding the following lines to the example's build files. - \section2 \e invoke-static.pro when using qmake: + \section2 \e invoke.pro when using qmake: - \quotefromfile invoke-static/invoke-static.pro + \quotefromfile invoke/invoke.pro \skipto QT \printline scxml @@ -41,7 +41,7 @@ \printline scxml \section2 \e CMakeLists.txt when using cmake: - \quotefromfile invoke-static/CMakeLists.txt + \quotefromfile invoke/CMakeLists.txt \skipto find_package \printline Scxml \skipto target_link_libraries @@ -58,10 +58,10 @@ \section1 Instantiating the State Machine - We instantiate the generated \c Directions class in the \e invoke-static.cpp + We instantiate the generated \c Directions class in the \e invoke.cpp file, as follows: - \quotefromfile invoke-static/invoke-static.cpp + \quotefromfile invoke/invoke.cpp \skipto statemachine.h \printuntil } */ diff --git a/examples/scxml/invoke-static/invoke-static.cpp b/examples/scxml/invoke/invoke.cpp index 2aa592d..9a64243 100644 --- a/examples/scxml/invoke-static/invoke-static.cpp +++ b/examples/scxml/invoke/invoke.cpp @@ -14,7 +14,7 @@ int main(int argc, char *argv[]) qmlRegisterType<Directions>("Directions", 1, 0, "Directions"); QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/invoke-static.qml"))); + engine.load(QUrl(QStringLiteral("qrc:/invoke.qml"))); if (engine.rootObjects().isEmpty()) return -1; diff --git a/examples/scxml/invoke/invoke.pro b/examples/scxml/invoke/invoke.pro new file mode 100644 index 0000000..866ecdb --- /dev/null +++ b/examples/scxml/invoke/invoke.pro @@ -0,0 +1,14 @@ +TEMPLATE = app + +QT += qml scxml +CONFIG += c++11 + +SOURCES += invoke.cpp + +RESOURCES += invoke.qrc + +STATECHARTS = statemachine.scxml + +target.path = $$[QT_INSTALL_EXAMPLES]/scxml/invoke +INSTALLS += target + diff --git a/examples/scxml/invoke-static/invoke-static.qml b/examples/scxml/invoke/invoke.qml index e28a6f2..e28a6f2 100644 --- a/examples/scxml/invoke-static/invoke-static.qml +++ b/examples/scxml/invoke/invoke.qml diff --git a/examples/scxml/invoke/invoke.qrc b/examples/scxml/invoke/invoke.qrc new file mode 100644 index 0000000..24c0e89 --- /dev/null +++ b/examples/scxml/invoke/invoke.qrc @@ -0,0 +1,8 @@ +<RCC> + <qresource prefix="/"> + <file>invoke.qml</file> + <file alias="MainView.qml">MainView.qml</file> + <file alias="SubView.qml">SubView.qml</file> + <file alias="Button.qml">Button.qml</file> + </qresource> +</RCC> diff --git a/examples/scxml/invoke-common/statemachine.scxml b/examples/scxml/invoke/statemachine.scxml index 6a0f5a9..6a0f5a9 100644 --- a/examples/scxml/invoke-common/statemachine.scxml +++ b/examples/scxml/invoke/statemachine.scxml diff --git a/examples/scxml/scxml.pro b/examples/scxml/scxml.pro index c7415a5..0c6b6a3 100644 --- a/examples/scxml/scxml.pro +++ b/examples/scxml/scxml.pro @@ -13,8 +13,7 @@ qtHaveModule(quick) { SUBDIRS += trafficlight-qml-dynamic SUBDIRS += trafficlight-qml-simple SUBDIRS += mediaplayer - SUBDIRS += invoke-static - SUBDIRS += invoke-dynamic + SUBDIRS += invoke } SUBDIRS += ftpclient |