diff options
author | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2022-02-28 11:04:09 +0100 |
---|---|---|
committer | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2022-09-26 00:16:40 +0200 |
commit | 8d613f693ec8d9ff48f6c82f842206e6b1e9b889 (patch) | |
tree | c481cd3c5e8adae4255ef7d0de6e90a281728599 /examples | |
parent | d9d9b0c3aa4b9674fe177e95220b18a80074891f (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
Pick-to: 6.2 6.4
Change-Id: I124863e50a9cf201981ea073d5b2096d511271a4
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/quickcontrols2/swipetoremove/CMakeLists.txt | 32 | ||||
-rw-r--r-- | examples/quickcontrols2/swipetoremove/swipetoremove.pro | 7 |
2 files changed, 14 insertions, 25 deletions
diff --git a/examples/quickcontrols2/swipetoremove/CMakeLists.txt b/examples/quickcontrols2/swipetoremove/CMakeLists.txt index 0004f21d42..813f9f1e1f 100644 --- a/examples/quickcontrols2/swipetoremove/CMakeLists.txt +++ b/examples/quickcontrols2/swipetoremove/CMakeLists.txt @@ -7,42 +7,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 |