diff options
author | Craig Scott <craig.scott@qt.io> | 2021-08-18 18:16:17 +1000 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-08-23 07:47:27 +0000 |
commit | ed5ce0deddd379228318db635f51bf87b98e2c12 (patch) | |
tree | 2a65e56f4493a241957425a19fcf66b64a691e1f | |
parent | 18d19ea39aaaaa1a689da8fca493df21434bc593 (diff) |
Use the new QML CMake API for examples, tests and docs
The qt6_qml_type_registration() command will become internal. Update
the examples, tests and docs to no longer call this command and use
the new QML CMake API available from Qt 6.2 instead.
Task-number: QTBUG-95093
Change-Id: Ibd62ccb4e2723a64d8a2c4418982037419d19855
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 03b026e2c46ac8badd7391897b67a54358479bfa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
5 files changed, 41 insertions, 72 deletions
diff --git a/examples/positioning/satelliteinfo/CMakeLists.txt b/examples/positioning/satelliteinfo/CMakeLists.txt index 21613877..dd90a6e1 100644 --- a/examples/positioning/satelliteinfo/CMakeLists.txt +++ b/examples/positioning/satelliteinfo/CMakeLists.txt @@ -35,17 +35,11 @@ target_link_libraries(satelliteinfo PRIVATE Qt::Quick ) - -# Resources: -set(satelliteinfo_resource_files - "satelliteinfo.qml" -) - -qt6_add_resources(satelliteinfo "satelliteinfo" - PREFIX - "/" - FILES - ${satelliteinfo_resource_files} +qt_add_qml_module(satelliteinfo + URI Local + VERSION 1.0 + QML_FILES satelliteinfo.qml + NO_RESOURCE_TARGET_PATH ) install(TARGETS satelliteinfo @@ -53,9 +47,3 @@ install(TARGETS satelliteinfo BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(satelliteinfo PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI Local -) -qt6_qml_type_registration(satelliteinfo) diff --git a/examples/positioning/satelliteinfo/doc/src/satelliteinfo.qdoc b/examples/positioning/satelliteinfo/doc/src/satelliteinfo.qdoc index 2136c440..fb314ea3 100644 --- a/examples/positioning/satelliteinfo/doc/src/satelliteinfo.qdoc +++ b/examples/positioning/satelliteinfo/doc/src/satelliteinfo.qdoc @@ -120,10 +120,8 @@ \c {CMakeLists.txt}: \quotefromfile satelliteinfo/CMakeLists.txt - \skipto set_target_properties - \printuntil PROPERTIES - \skipto QT_QML_MODULE_VERSION 1.0 - \printuntil qt6_qml_type_registration(satelliteinfo) + \skipto qt_add_qml_module(satelliteinfo + \printuntil ) \section2 qmake Build diff --git a/examples/positioning/weatherinfo/CMakeLists.txt b/examples/positioning/weatherinfo/CMakeLists.txt index 32225dc0..07407fd2 100644 --- a/examples/positioning/weatherinfo/CMakeLists.txt +++ b/examples/positioning/weatherinfo/CMakeLists.txt @@ -39,32 +39,28 @@ target_link_libraries(weatherinfo PRIVATE Qt::Quick ) - -# Resources: -set(weatherinfo_resource_files - "components/BigForecastIcon.qml" - "components/ForecastIcon.qml" - "components/WeatherIcon.qml" - "icons/weather-few-clouds.png" - "icons/weather-fog.png" - "icons/weather-haze.png" - "icons/weather-icy.png" - "icons/weather-overcast.png" - "icons/weather-showers.png" - "icons/weather-sleet.png" - "icons/weather-snow.png" - "icons/weather-storm.png" - "icons/weather-sunny-very-few-clouds.png" - "icons/weather-sunny.png" - "icons/weather-thundershower.png" - "weatherinfo.qml" -) - -qt6_add_resources(weatherinfo "weatherinfo" - PREFIX - "/" - FILES - ${weatherinfo_resource_files} +qt_add_qml_module(weatherinfo + URI WeatherInfo + VERSION 1.0 + QML_FILES + components/BigForecastIcon.qml + components/ForecastIcon.qml + components/WeatherIcon.qml + weatherinfo.qml + RESOURCES + icons/weather-few-clouds.png + icons/weather-fog.png + icons/weather-haze.png + icons/weather-icy.png + icons/weather-overcast.png + icons/weather-showers.png + icons/weather-sleet.png + icons/weather-snow.png + icons/weather-storm.png + icons/weather-sunny-very-few-clouds.png + icons/weather-sunny.png + icons/weather-thundershower.png + NO_RESOURCE_TARGET_PATH ) install(TARGETS weatherinfo @@ -72,9 +68,3 @@ install(TARGETS weatherinfo BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(weatherinfo PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI WeatherInfo -) -qt6_qml_type_registration(weatherinfo) diff --git a/examples/positioning/weatherinfo/doc/src/weatherinfo.qdoc b/examples/positioning/weatherinfo/doc/src/weatherinfo.qdoc index f12d0216..12f0387e 100644 --- a/examples/positioning/weatherinfo/doc/src/weatherinfo.qdoc +++ b/examples/positioning/weatherinfo/doc/src/weatherinfo.qdoc @@ -105,10 +105,8 @@ \c {CMakeLists.txt}: \quotefromfile weatherinfo/CMakeLists.txt - \skipto set_target_properties - \printuntil PROPERTIES - \skipto QT_QML_MODULE_VERSION 1.0 - \printuntil qt6_qml_type_registration(weatherinfo) + \skipto qt_add_qml_module(weatherinfo + \printuntil ) \section2 qmake Build diff --git a/tests/auto/declarative_positioning_core/CMakeLists.txt b/tests/auto/declarative_positioning_core/CMakeLists.txt index 673d2856..0afb3021 100644 --- a/tests/auto/declarative_positioning_core/CMakeLists.txt +++ b/tests/auto/declarative_positioning_core/CMakeLists.txt @@ -22,19 +22,14 @@ qt_internal_add_test(tst_declarative_positioning_core TESTDATA ${test_data} ) -# special case begin - -# These properties are required for the qt6_qml_type_registration() -# to work properly -set_target_properties(tst_declarative_positioning_core - PROPERTIES - QT_QML_MODULE_URI TestFactory - QT_QML_MODULE_VERSION 1.0 +qt_add_qml_module(tst_declarative_positioning_core + URI TestFactory + VERSION 1.0 + QML_FILES + tst_address.qml + tst_coordinate.qml + tst_geoshape.qml + tst_position.qml + tst_positionsource.qml + NO_RESOURCE_TARGET_PATH ) - -qt6_qml_type_registration(tst_declarative_positioning_core) - -# special case end - -#### Keys ignored in scope 1:.:.:declarative_positioning_core.pro:<TRUE>: -# TEMPLATE = "app" |