aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Eftevaag <oliver.eftevaag@qt.io>2022-09-22 15:43:17 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-09-26 01:36:22 +0000
commitde518cc61b7e430e2e43b79e1983d315f25c67e4 (patch)
tree76fc89fa9f7bf526c2c9ea1e75658a2a68692be6
parent379ceb1a06f2a8efb7f3ca5f6eeb8733cd53dc23 (diff)
Gallery example: Use qt_add_qml_module() in CMakeLists.txt
We want to use qt_add_qml_module() instead of qt_add_resources(). Note that this change also changes the target to 'galleryexample', which will also affect the name of the executable. I'm making that change in order to be consistent with other examples. Task-number: QTBUG-98130 Change-Id: I1ed1af18a01b652673828c60e803cb2ea9b04a3d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit fa00dee21ccd6f7ec159a8d88756df6e778b8d32) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--examples/quickcontrols2/gallery/CMakeLists.txt142
1 files changed, 67 insertions, 75 deletions
diff --git a/examples/quickcontrols2/gallery/CMakeLists.txt b/examples/quickcontrols2/gallery/CMakeLists.txt
index 3d689fe6b1..fff4253b4b 100644
--- a/examples/quickcontrols2/gallery/CMakeLists.txt
+++ b/examples/quickcontrols2/gallery/CMakeLists.txt
@@ -11,16 +11,76 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/gallery")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickControls2)
-qt_add_executable(gallery_controls2
+qt_add_executable(galleryexample WIN32 MACOSX_BUNDLE
gallery.cpp
)
-set_target_properties(gallery_controls2 PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
+qt_add_qml_module(galleryexample
+ URI gallery
+ VERSION 1.0
+ NO_RESOURCE_TARGET_PATH
+ QML_FILES
+ "+Material/ToolBar.qml"
+ "ToolBar.qml"
+ "gallery.qml"
+ "pages/BusyIndicatorPage.qml"
+ "pages/ButtonPage.qml"
+ "pages/CheckBoxPage.qml"
+ "pages/ComboBoxPage.qml"
+ "pages/DelayButtonPage.qml"
+ "pages/DelegatePage.qml"
+ "pages/DialPage.qml"
+ "pages/DialogPage.qml"
+ "pages/FramePage.qml"
+ "pages/GroupBoxPage.qml"
+ "pages/PageIndicatorPage.qml"
+ "pages/ProgressBarPage.qml"
+ "pages/RadioButtonPage.qml"
+ "pages/RangeSliderPage.qml"
+ "pages/ScrollBarPage.qml"
+ "pages/ScrollIndicatorPage.qml"
+ "pages/ScrollablePage.qml"
+ "pages/SliderPage.qml"
+ "pages/SpinBoxPage.qml"
+ "pages/StackViewPage.qml"
+ "pages/SwipeViewPage.qml"
+ "pages/SwitchPage.qml"
+ "pages/TabBarPage.qml"
+ "pages/TextAreaPage.qml"
+ "pages/TextFieldPage.qml"
+ "pages/ToolTipPage.qml"
+ "pages/TumblerPage.qml"
+ RESOURCES
+ "icons/gallery/20x20/back.png"
+ "icons/gallery/20x20/drawer.png"
+ "icons/gallery/20x20/menu.png"
+ "icons/gallery/20x20@2/back.png"
+ "icons/gallery/20x20@2/drawer.png"
+ "icons/gallery/20x20@2/menu.png"
+ "icons/gallery/20x20@3/back.png"
+ "icons/gallery/20x20@3/drawer.png"
+ "icons/gallery/20x20@3/menu.png"
+ "icons/gallery/20x20@4/back.png"
+ "icons/gallery/20x20@4/drawer.png"
+ "icons/gallery/20x20@4/menu.png"
+ "icons/gallery/index.theme"
+ "images/arrow.png"
+ "images/arrow@2x.png"
+ "images/arrow@3x.png"
+ "images/arrow@4x.png"
+ "images/arrows.png"
+ "images/arrows@2x.png"
+ "images/arrows@3x.png"
+ "images/arrows@4x.png"
+ "images/qt-logo.png"
+ "images/qt-logo@2x.png"
+ "images/qt-logo@3x.png"
+ "images/qt-logo@4x.png"
+ "qmldir"
+ "qtquickcontrols2.conf"
)
-target_link_libraries(gallery_controls2 PUBLIC
+target_link_libraries(galleryexample PUBLIC
Qt::Core
Qt::Gui
Qt::Quick
@@ -31,78 +91,10 @@ if(UNIX AND NOT APPLE AND CMAKE_CROSSCOMPILING)
find_package(Qt6 REQUIRED COMPONENTS QuickTemplates2)
# Work around QTBUG-86533
- target_link_libraries(gallery_controls2 PRIVATE Qt::QuickTemplates2)
+ target_link_libraries(galleryexample PRIVATE Qt::QuickTemplates2)
endif()
-# Resources:
-set(qmake_immediate_resource_files
- "+Material/ToolBar.qml"
- "ToolBar.qml"
- "gallery.qml"
- "icons/gallery/20x20/back.png"
- "icons/gallery/20x20/drawer.png"
- "icons/gallery/20x20/menu.png"
- "icons/gallery/20x20@2/back.png"
- "icons/gallery/20x20@2/drawer.png"
- "icons/gallery/20x20@2/menu.png"
- "icons/gallery/20x20@3/back.png"
- "icons/gallery/20x20@3/drawer.png"
- "icons/gallery/20x20@3/menu.png"
- "icons/gallery/20x20@4/back.png"
- "icons/gallery/20x20@4/drawer.png"
- "icons/gallery/20x20@4/menu.png"
- "icons/gallery/index.theme"
- "images/arrow.png"
- "images/arrow@2x.png"
- "images/arrow@3x.png"
- "images/arrow@4x.png"
- "images/arrows.png"
- "images/arrows@2x.png"
- "images/arrows@3x.png"
- "images/arrows@4x.png"
- "images/qt-logo.png"
- "images/qt-logo@2x.png"
- "images/qt-logo@3x.png"
- "images/qt-logo@4x.png"
- "pages/BusyIndicatorPage.qml"
- "pages/ButtonPage.qml"
- "pages/CheckBoxPage.qml"
- "pages/ComboBoxPage.qml"
- "pages/DelayButtonPage.qml"
- "pages/DelegatePage.qml"
- "pages/DialPage.qml"
- "pages/DialogPage.qml"
- "pages/FramePage.qml"
- "pages/GroupBoxPage.qml"
- "pages/PageIndicatorPage.qml"
- "pages/ProgressBarPage.qml"
- "pages/RadioButtonPage.qml"
- "pages/RangeSliderPage.qml"
- "pages/ScrollBarPage.qml"
- "pages/ScrollIndicatorPage.qml"
- "pages/ScrollablePage.qml"
- "pages/SliderPage.qml"
- "pages/SpinBoxPage.qml"
- "pages/StackViewPage.qml"
- "pages/SwipeViewPage.qml"
- "pages/SwitchPage.qml"
- "pages/TabBarPage.qml"
- "pages/TextAreaPage.qml"
- "pages/TextFieldPage.qml"
- "pages/ToolTipPage.qml"
- "pages/TumblerPage.qml"
- "qmldir"
- "qtquickcontrols2.conf"
-)
-
-qt6_add_resources(gallery_controls2 "qmake_immediate"
- PREFIX
- "/"
- FILES
- ${qmake_immediate_resource_files}
-)
-
-install(TARGETS gallery_controls2
+install(TARGETS galleryexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"