aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qml')
-rw-r--r--examples/qml/qmlextensionplugins/CMakeLists.txt39
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/import/CMakeLists.txt10
2 files changed, 21 insertions, 28 deletions
diff --git a/examples/qml/qmlextensionplugins/CMakeLists.txt b/examples/qml/qmlextensionplugins/CMakeLists.txt
index 7fc2b7268f..dcfde4a8ae 100644
--- a/examples/qml/qmlextensionplugins/CMakeLists.txt
+++ b/examples/qml/qmlextensionplugins/CMakeLists.txt
@@ -1,7 +1,7 @@
# Generated from qmlextensionplugins.pro.
cmake_minimum_required(VERSION 3.14)
-project(qmlqtimeexampleplugin LANGUAGES CXX)
+project(qmlqtimeexample LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -19,37 +19,38 @@ find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Qml)
-qt6_add_qml_module(qmlqtimeexampleplugin
+set_source_files_properties(imports/TimeExample/Clock.qml PROPERTIES
+ QT_RESOURCE_ALIAS Clock.qml
+)
+qt6_add_qml_module(qmlqtimeexample
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/imports/TimeExample"
VERSION 1.0
URI "TimeExample"
- INSTALL_LOCATION ${INSTALL_EXAMPLEDIR}
-)
-
-target_sources(qmlqtimeexampleplugin PRIVATE
- plugin.cpp
- timemodel.cpp timemodel.h
+ SOURCES timemodel.cpp timemodel.h
+ QML_FILES imports/TimeExample/Clock.qml
)
-set_target_properties(qmlqtimeexampleplugin PROPERTIES
+set_target_properties(qmlqtimeexample PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_link_libraries(qmlqtimeexampleplugin PUBLIC
+target_link_libraries(qmlqtimeexample PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
)
-install(TARGETS qmlqtimeexampleplugin
+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}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(qmlqtimeexampleplugin PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI TimeExample
- QT_QMLTYPES_FILENAME imports/TimeExample/plugins.qmltypes
-)
-
-qt6_qml_type_registration(qmlqtimeexampleplugin)
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter6-plugins/import/CMakeLists.txt
index ad3a5972e8..f75028aa69 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/import/CMakeLists.txt
@@ -24,11 +24,10 @@ qt6_add_qml_module(chartsplugin
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../Charts"
VERSION 1.0
URI "Charts"
- INSTALL_LOCATION ${INSTALL_EXAMPLEDIR}
+ PLUGIN_TARGET chartsplugin
)
target_sources(chartsplugin PRIVATE
- chartsplugin.h
piechart.cpp piechart.h
pieslice.cpp pieslice.h
)
@@ -48,10 +47,3 @@ install(TARGETS chartsplugin
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(chartsplugin PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI Charts
-)
-
-qt6_qml_type_registration(chartsplugin)