aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/qmlextensionplugins
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@qt.io>2021-08-23 16:29:18 +1000
committerCraig Scott <craig.scott@qt.io>2021-08-24 16:08:21 +1000
commit9e1d2a0eb15487f8f2acb4d91b281568897fb4e1 (patch)
treee055ea022161b4dbbecbb94c2c1fa7c4a83a5ee8 /examples/qml/qmlextensionplugins
parent05bee5bb50378b76b6441895c533f50d99db445e (diff)
Update qml examples for improved target path handling
Some examples were still using the old "add as ordinary resources" approach for QML modules, others needed adjustment to the subdirectory structure to better reflect the URI structure of the QML modules involved. Task-number: QTBUG-95144 Pick-to: 6.2 Change-Id: Ie3399410cf6df491eb1e7b4a589ca26c577d82a0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'examples/qml/qmlextensionplugins')
-rw-r--r--examples/qml/qmlextensionplugins/CMakeLists.txt30
1 files changed, 16 insertions, 14 deletions
diff --git a/examples/qml/qmlextensionplugins/CMakeLists.txt b/examples/qml/qmlextensionplugins/CMakeLists.txt
index 62a92e6033..8156f23eb1 100644
--- a/examples/qml/qmlextensionplugins/CMakeLists.txt
+++ b/examples/qml/qmlextensionplugins/CMakeLists.txt
@@ -14,20 +14,32 @@ if(NOT DEFINED INSTALL_EXAMPLESDIR)
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qml/qmlextensionplugins/imports/TimeExample")
-set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/examples/qml/qmlextensionplugins/imports)
find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Qml)
-set_source_files_properties(imports/TimeExample/Clock.qml PROPERTIES
- QT_RESOURCE_ALIAS Clock.qml
+set(qml_files
+ imports/TimeExample/Clock.qml
)
+set(images
+ imports/TimeExample/center.png
+ imports/TimeExample/clock.png
+ imports/TimeExample/hour.png
+ imports/TimeExample/minute.png
+)
+foreach(file IN LISTS qml_files images)
+ get_filename_component(filename ${file} NAME)
+ set_source_files_properties(${file} PROPERTIES QT_RESOURCE_ALIAS ${filename})
+endforeach()
+
qt6_add_qml_module(qmlqtimeexample
+ OUTPUT_DIRECTORY TimeExample
VERSION 1.0
URI "TimeExample"
SOURCES timemodel.cpp timemodel.h
- QML_FILES imports/TimeExample/Clock.qml
+ QML_FILES ${qml_files}
+ RESOURCES ${images}
)
set_target_properties(qmlqtimeexample PROPERTIES
WIN32_EXECUTABLE TRUE
@@ -39,16 +51,6 @@ target_link_libraries(qmlqtimeexample PUBLIC
Qt::Qml
)
-qt6_add_resources(qmlqtimeexample example_images
- PREFIX "/TimeExample"
- BASE imports/TimeExample
- FILES
- imports/TimeExample/center.png
- imports/TimeExample/clock.png
- imports/TimeExample/hour.png
- imports/TimeExample/minute.png
-)
-
install(TARGETS qmlqtimeexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"