diff options
Diffstat (limited to 'examples/widgets/layouts/flowlayout')
-rw-r--r-- | examples/widgets/layouts/flowlayout/CMakeLists.txt | 31 | ||||
-rw-r--r-- | examples/widgets/layouts/flowlayout/flowlayout.cpp | 4 |
2 files changed, 18 insertions, 17 deletions
diff --git a/examples/widgets/layouts/flowlayout/CMakeLists.txt b/examples/widgets/layouts/flowlayout/CMakeLists.txt index 8567cd49b6..9693d409b7 100644 --- a/examples/widgets/layouts/flowlayout/CMakeLists.txt +++ b/examples/widgets/layouts/flowlayout/CMakeLists.txt @@ -4,16 +4,10 @@ cmake_minimum_required(VERSION 3.16) project(flowlayout LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/layouts/flowlayout") - find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets) +qt_standard_project_setup() + qt_add_executable(flowlayout flowlayout.cpp flowlayout.h main.cpp @@ -25,14 +19,21 @@ set_target_properties(flowlayout PROPERTIES MACOSX_BUNDLE TRUE ) -target_link_libraries(flowlayout PUBLIC - Qt::Core - Qt::Gui - Qt::Widgets +target_link_libraries(flowlayout PRIVATE + Qt6::Core + Qt6::Gui + Qt6::Widgets ) install(TARGETS flowlayout - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION . + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +qt_generate_deploy_app_script( + TARGET flowlayout + OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR ) +install(SCRIPT ${deploy_script}) diff --git a/examples/widgets/layouts/flowlayout/flowlayout.cpp b/examples/widgets/layouts/flowlayout/flowlayout.cpp index b4cba9fe69..0565053096 100644 --- a/examples/widgets/layouts/flowlayout/flowlayout.cpp +++ b/examples/widgets/layouts/flowlayout/flowlayout.cpp @@ -108,7 +108,7 @@ QSize FlowLayout::sizeHint() const QSize FlowLayout::minimumSize() const { QSize size; - for (const QLayoutItem *item : qAsConst(itemList)) + for (const QLayoutItem *item : std::as_const(itemList)) size = size.expandedTo(item->minimumSize()); const QMargins margins = contentsMargins(); @@ -129,7 +129,7 @@ int FlowLayout::doLayout(const QRect &rect, bool testOnly) const //! [9] //! [10] - for (QLayoutItem *item : qAsConst(itemList)) { + for (QLayoutItem *item : std::as_const(itemList)) { const QWidget *wid = item->widget(); int spaceX = horizontalSpacing(); if (spaceX == -1) |