aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorOliver Eftevaag <oliver.eftevaag@qt.io>2022-02-28 11:04:09 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-09-26 01:36:26 +0000
commitd721c094a86467ae15ea0c4e90218bc3a152dc00 (patch)
tree6cd321d9f4ad14deed79ff6f19e42d83fea32cf0 /examples
parent550590ca726df1afbc477c3f5983fcd845bd1cd6 (diff)
SwipeToRemove example: use qt_add_qml_module() in CMakeLists.txt
We want our examples to use qt_add_qml_module(), since it has a lot of advantage over the old method of using qt6_add_resources(). Task-number: QTBUG-98130 Change-Id: I124863e50a9cf201981ea073d5b2096d511271a4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 8d613f693ec8d9ff48f6c82f842206e6b1e9b889) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/quickcontrols2/swipetoremove/CMakeLists.txt32
-rw-r--r--examples/quickcontrols2/swipetoremove/swipetoremove.pro7
2 files changed, 14 insertions, 25 deletions
diff --git a/examples/quickcontrols2/swipetoremove/CMakeLists.txt b/examples/quickcontrols2/swipetoremove/CMakeLists.txt
index 66862b9171..8b3c1578c9 100644
--- a/examples/quickcontrols2/swipetoremove/CMakeLists.txt
+++ b/examples/quickcontrols2/swipetoremove/CMakeLists.txt
@@ -4,42 +4,34 @@ project(swipetoremove LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/swipetoremove")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml)
-qt_add_executable(swipetoremove
+qt_add_executable(swipetoremoveexample WIN32 MACOSX_BUNDLE
swipetoremove.cpp
)
-
-set_target_properties(swipetoremove PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-target_link_libraries(swipetoremove PUBLIC
+target_link_libraries(swipetoremoveexample PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
)
# Resources:
-set(qmake_immediate_resource_files
- "fonts/fontello.ttf"
- "swipetoremove.qml"
-)
-
-qt6_add_resources(swipetoremove "qmake_immediate"
- PREFIX
- "/"
- FILES
- ${qmake_immediate_resource_files}
+qt_add_qml_module(swipetoremoveexample
+ URI swipetoremove
+ VERSION 1.0
+ NO_RESOURCE_TARGET_PATH
+ QML_FILES
+ "swipetoremove.qml"
+ RESOURCES
+ "fonts/fontello.ttf"
)
-install(TARGETS swipetoremove
+install(TARGETS swipetoremoveexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/quickcontrols2/swipetoremove/swipetoremove.pro b/examples/quickcontrols2/swipetoremove/swipetoremove.pro
index 8e6bd5f663..bcdb45cd45 100644
--- a/examples/quickcontrols2/swipetoremove/swipetoremove.pro
+++ b/examples/quickcontrols2/swipetoremove/swipetoremove.pro
@@ -2,12 +2,9 @@ TEMPLATE = app
TARGET = swipetoremove
QT += qml
-SOURCES += \
- swipetoremove.cpp
+SOURCES += swipetoremove.cpp
-RESOURCES += \
- swipetoremove.qml \
- fonts/fontello.ttf
+RESOURCES += swipetoremove.qml
target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/swipetoremove
INSTALLS += target