diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2019-08-22 11:45:45 +0200 |
---|---|---|
committer | Leander Beernaert <leander.beernaert@qt.io> | 2019-08-23 13:51:06 +0000 |
commit | b938edcfb3aa2c78e35c9d63d995f6824e14eadf (patch) | |
tree | 593a1eb2158d47b67d422259721198956d9f9a7f /examples/qml/referenceexamples | |
parent | 2be575b4b1e6f6e11a8dbd0b1c05c003828d2598 (diff) |
Convert Examples
This patch converts all examples in qtdeclarative except for a few
exceptions which require a public facing qml plugin api.
Change-Id: I2cd2b1bb455be8b48796893a8235dea7f8b35aa2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'examples/qml/referenceexamples')
12 files changed, 506 insertions, 31 deletions
diff --git a/examples/qml/referenceexamples/CMakeLists.txt b/examples/qml/referenceexamples/CMakeLists.txt index f7ba5c0565..827e3b0060 100644 --- a/examples/qml/referenceexamples/CMakeLists.txt +++ b/examples/qml/referenceexamples/CMakeLists.txt @@ -1,19 +1,17 @@ # Generated from referenceexamples.pro. add_subdirectory(adding) -#add_subdirectory(coercion) -#add_subdirectory(default) -#add_subdirectory(properties) -#add_subdirectory(methods) - -#if(TARGET Qt::Widgets) - #add_subdirectory(extended) -#endif() - -#if(TARGET Qt::Quick) - #add_subdirectory(attached) - #add_subdirectory(binding) - #add_subdirectory(grouped) - #add_subdirectory(signal) - #add_subdirectory(valuesource) -#endif() +add_subdirectory(coercion) +add_subdirectory(default) +add_subdirectory(properties) +add_subdirectory(methods) +if(TARGET Qt::Widgets) + add_subdirectory(extended) +endif() +if(TARGET Qt::Quick) + add_subdirectory(attached) + add_subdirectory(binding) + add_subdirectory(grouped) + add_subdirectory(signal) + add_subdirectory(valuesource) +endif() diff --git a/examples/qml/referenceexamples/adding/CMakeLists.txt b/examples/qml/referenceexamples/adding/CMakeLists.txt index 5f2b272d3f..4febb6fb06 100644 --- a/examples/qml/referenceexamples/adding/CMakeLists.txt +++ b/examples/qml/referenceexamples/adding/CMakeLists.txt @@ -1,21 +1,43 @@ # Generated from adding.pro. -##################################################################### -## adding Binary: -##################################################################### - -add_qt_executable(adding - GUI - OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/qml/referenceexamples/adding" - INSTALL_DIRECTORY "${INSTALL_EXAMPLESDIR}/qml/referenceexamples/adding" - SOURCES - main.cpp - person.cpp person.h - PUBLIC_LIBRARIES - Qt::Qml +cmake_minimum_required(VERSION 3.14) +project(adding LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(adding + main.cpp + person.cpp person.h +) +target_link_libraries(adding PUBLIC + Qt::Core + Qt::Qml ) # Resources: -add_qt_resource(adding "adding" FILES - example.qml) +set(adding_resource_files + "example.qml" +) + +QT6_ADD_RESOURCES(adding "adding" + PREFIX + "/" + FILES + ${adding_resource_files} +) + +install(TARGETS adding + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/qml/referenceexamples/attached/CMakeLists.txt b/examples/qml/referenceexamples/attached/CMakeLists.txt new file mode 100644 index 0000000000..4d17701aac --- /dev/null +++ b/examples/qml/referenceexamples/attached/CMakeLists.txt @@ -0,0 +1,46 @@ +# Generated from attached.pro. + +cmake_minimum_required(VERSION 3.14) +project(attached LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(attached + birthdayparty.cpp birthdayparty.h + main.cpp + person.cpp person.h +) +target_link_libraries(attached PUBLIC + Qt::Core + Qt::Gui + Qt::Qml +) + +# Resources: +set(attached_resource_files + "example.qml" +) + +QT6_ADD_RESOURCES(attached "attached" + PREFIX + "/" + FILES + ${attached_resource_files} +) + + +install(TARGETS attached + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/qml/referenceexamples/binding/CMakeLists.txt b/examples/qml/referenceexamples/binding/CMakeLists.txt new file mode 100644 index 0000000000..e117e71b01 --- /dev/null +++ b/examples/qml/referenceexamples/binding/CMakeLists.txt @@ -0,0 +1,47 @@ +# Generated from binding.pro. + +cmake_minimum_required(VERSION 3.14) +project(binding LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(binding + birthdayparty.cpp birthdayparty.h + happybirthdaysong.cpp happybirthdaysong.h + main.cpp + person.cpp person.h +) +target_link_libraries(binding PUBLIC + Qt::Core + Qt::Gui + Qt::Qml +) + +# Resources: +set(binding_resource_files + "example.qml" +) + +QT6_ADD_RESOURCES(binding "binding" + PREFIX + "/" + FILES + ${binding_resource_files} +) + + +install(TARGETS binding + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/qml/referenceexamples/coercion/CMakeLists.txt b/examples/qml/referenceexamples/coercion/CMakeLists.txt new file mode 100644 index 0000000000..57307576a1 --- /dev/null +++ b/examples/qml/referenceexamples/coercion/CMakeLists.txt @@ -0,0 +1,44 @@ +# Generated from coercion.pro. + +cmake_minimum_required(VERSION 3.14) +project(coercion LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(coercion + birthdayparty.cpp birthdayparty.h + main.cpp + person.cpp person.h +) +target_link_libraries(coercion PUBLIC + Qt::Core + Qt::Qml +) + +# Resources: +set(coercion_resource_files + "example.qml" +) + +QT6_ADD_RESOURCES(coercion "coercion" + PREFIX + "/" + FILES + ${coercion_resource_files} +) + + +install(TARGETS coercion + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/qml/referenceexamples/default/CMakeLists.txt b/examples/qml/referenceexamples/default/CMakeLists.txt new file mode 100644 index 0000000000..2ed8122110 --- /dev/null +++ b/examples/qml/referenceexamples/default/CMakeLists.txt @@ -0,0 +1,44 @@ +# Generated from default.pro. + +cmake_minimum_required(VERSION 3.14) +project(default LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(default + birthdayparty.cpp birthdayparty.h + main.cpp + person.cpp person.h +) +target_link_libraries(default PUBLIC + Qt::Core + Qt::Qml +) + +# Resources: +set(default_resource_files + "example.qml" +) + +QT6_ADD_RESOURCES(default "default" + PREFIX + "/" + FILES + ${default_resource_files} +) + + +install(TARGETS default + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/qml/referenceexamples/extended/CMakeLists.txt b/examples/qml/referenceexamples/extended/CMakeLists.txt new file mode 100644 index 0000000000..e44df6ed1f --- /dev/null +++ b/examples/qml/referenceexamples/extended/CMakeLists.txt @@ -0,0 +1,47 @@ +# Generated from extended.pro. + +cmake_minimum_required(VERSION 3.14) +project(extended LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) +find_package(Qt6 COMPONENTS Widgets) + +add_qt_gui_executable(extended + lineedit.cpp lineedit.h + main.cpp +) +target_link_libraries(extended PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Widgets +) + +# Resources: +set(extended_resource_files + "example.qml" +) + +QT6_ADD_RESOURCES(extended "extended" + PREFIX + "/" + FILES + ${extended_resource_files} +) + + +install(TARGETS extended + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/qml/referenceexamples/grouped/CMakeLists.txt b/examples/qml/referenceexamples/grouped/CMakeLists.txt new file mode 100644 index 0000000000..425c04c89c --- /dev/null +++ b/examples/qml/referenceexamples/grouped/CMakeLists.txt @@ -0,0 +1,46 @@ +# Generated from grouped.pro. + +cmake_minimum_required(VERSION 3.14) +project(grouped LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(grouped + birthdayparty.cpp birthdayparty.h + main.cpp + person.cpp person.h +) +target_link_libraries(grouped PUBLIC + Qt::Core + Qt::Gui + Qt::Qml +) + +# Resources: +set(grouped_resource_files + "example.qml" +) + +QT6_ADD_RESOURCES(grouped "grouped" + PREFIX + "/" + FILES + ${grouped_resource_files} +) + + +install(TARGETS grouped + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/qml/referenceexamples/methods/CMakeLists.txt b/examples/qml/referenceexamples/methods/CMakeLists.txt new file mode 100644 index 0000000000..91b26a8726 --- /dev/null +++ b/examples/qml/referenceexamples/methods/CMakeLists.txt @@ -0,0 +1,44 @@ +# Generated from methods.pro. + +cmake_minimum_required(VERSION 3.14) +project(methods LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(methods + birthdayparty.cpp birthdayparty.h + main.cpp + person.cpp person.h +) +target_link_libraries(methods PUBLIC + Qt::Core + Qt::Qml +) + +# Resources: +set(methods_resource_files + "example.qml" +) + +QT6_ADD_RESOURCES(methods "methods" + PREFIX + "/" + FILES + ${methods_resource_files} +) + + +install(TARGETS methods + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/qml/referenceexamples/properties/CMakeLists.txt b/examples/qml/referenceexamples/properties/CMakeLists.txt new file mode 100644 index 0000000000..2fd2e346b7 --- /dev/null +++ b/examples/qml/referenceexamples/properties/CMakeLists.txt @@ -0,0 +1,44 @@ +# Generated from properties.pro. + +cmake_minimum_required(VERSION 3.14) +project(properties LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(properties + birthdayparty.cpp birthdayparty.h + main.cpp + person.cpp person.h +) +target_link_libraries(properties PUBLIC + Qt::Core + Qt::Qml +) + +# Resources: +set(properties_resource_files + "example.qml" +) + +QT6_ADD_RESOURCES(properties "properties" + PREFIX + "/" + FILES + ${properties_resource_files} +) + + +install(TARGETS properties + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/qml/referenceexamples/signal/CMakeLists.txt b/examples/qml/referenceexamples/signal/CMakeLists.txt new file mode 100644 index 0000000000..b619a922de --- /dev/null +++ b/examples/qml/referenceexamples/signal/CMakeLists.txt @@ -0,0 +1,46 @@ +# Generated from signal.pro. + +cmake_minimum_required(VERSION 3.14) +project(signal LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(signal + birthdayparty.cpp birthdayparty.h + main.cpp + person.cpp person.h +) +target_link_libraries(signal PUBLIC + Qt::Core + Qt::Gui + Qt::Qml +) + +# Resources: +set(signal_resource_files + "example.qml" +) + +QT6_ADD_RESOURCES(signal "signal" + PREFIX + "/" + FILES + ${signal_resource_files} +) + + +install(TARGETS signal + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/qml/referenceexamples/valuesource/CMakeLists.txt b/examples/qml/referenceexamples/valuesource/CMakeLists.txt new file mode 100644 index 0000000000..dfe31f8e3e --- /dev/null +++ b/examples/qml/referenceexamples/valuesource/CMakeLists.txt @@ -0,0 +1,47 @@ +# Generated from valuesource.pro. + +cmake_minimum_required(VERSION 3.14) +project(valuesource LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Qml) + +add_qt_gui_executable(valuesource + birthdayparty.cpp birthdayparty.h + happybirthdaysong.cpp happybirthdaysong.h + main.cpp + person.cpp person.h +) +target_link_libraries(valuesource PUBLIC + Qt::Core + Qt::Gui + Qt::Qml +) + +# Resources: +set(valuesource_resource_files + "example.qml" +) + +QT6_ADD_RESOURCES(valuesource "valuesource" + PREFIX + "/" + FILES + ${valuesource_resource_files} +) + + +install(TARGETS valuesource + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) |