diff options
Diffstat (limited to 'examples/quick/tableview')
5 files changed, 49 insertions, 40 deletions
diff --git a/examples/quick/tableview/gameoflife/CMakeLists.txt b/examples/quick/tableview/gameoflife/CMakeLists.txt index 8195fba9f6..0af748fc80 100644 --- a/examples/quick/tableview/gameoflife/CMakeLists.txt +++ b/examples/quick/tableview/gameoflife/CMakeLists.txt @@ -1,34 +1,27 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: BSD-3-Clause +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause cmake_minimum_required(VERSION 3.16) project(gameoflife LANGUAGES CXX) set(CMAKE_AUTOMOC ON) -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/tableview/gameoflife") - find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup(REQUIRES 6.5) + qt_add_executable(gameoflife + WIN32 + MACOSX_BUNDLE gameoflifemodel.cpp gameoflifemodel.h main.cpp ) -set_target_properties(gameoflife PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(gameoflife PUBLIC - Qt::Core - Qt::Gui - Qt::Qml - Qt::Quick +target_link_libraries(gameoflife PRIVATE + Qt6::Core + Qt6::Gui + Qt6::Qml + Qt6::Quick ) qt_add_qml_module(gameoflife @@ -41,7 +34,16 @@ qt_add_qml_module(gameoflife ) install(TARGETS gameoflife - 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_qml_app_script( + TARGET gameoflife + OUTPUT_SCRIPT deploy_script + MACOS_BUNDLE_POST_BUILD + NO_UNSUPPORTED_PLATFORM_ERROR + DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM ) +install(SCRIPT ${deploy_script}) diff --git a/examples/quick/tableview/gameoflife/doc/src/gameoflife.qdoc b/examples/quick/tableview/gameoflife/doc/src/gameoflife.qdoc index c7fffacecf..b8d594d598 100644 --- a/examples/quick/tableview/gameoflife/doc/src/gameoflife.qdoc +++ b/examples/quick/tableview/gameoflife/doc/src/gameoflife.qdoc @@ -5,6 +5,7 @@ \example tableview/gameoflife \brief The \e{Conway’s Game of Life} example shows how the QML TableView type can be used to display a C++ model that the user can pan around. + \examplecategory {Graphics} \image gameoflife.png \ingroup qtquickexamples diff --git a/examples/quick/tableview/gameoflife/main.qml b/examples/quick/tableview/gameoflife/main.qml index bedb624223..55c5b193f8 100644 --- a/examples/quick/tableview/gameoflife/main.qml +++ b/examples/quick/tableview/gameoflife/main.qml @@ -74,6 +74,7 @@ ApplicationWindow { text: qsTr("Next") onClicked: gameOfLifeModel.nextStep() Layout.rightMargin: 50 + Layout.fillWidth: false } //! [next] @@ -82,10 +83,12 @@ ApplicationWindow { from: 0 to: 1 value: 0.9 + Layout.fillWidth: false } Button { text: timer.running ? "❙❙" : "▶️" + Layout.fillWidth: false onClicked: timer.running = !timer.running } } diff --git a/examples/quick/tableview/pixelator/CMakeLists.txt b/examples/quick/tableview/pixelator/CMakeLists.txt index 6de15b8615..de24974bcd 100644 --- a/examples/quick/tableview/pixelator/CMakeLists.txt +++ b/examples/quick/tableview/pixelator/CMakeLists.txt @@ -1,34 +1,27 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: BSD-3-Clause +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause cmake_minimum_required(VERSION 3.16) project(qml_pixelator LANGUAGES CXX) set(CMAKE_AUTOMOC ON) -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/tableview/pixelator") - find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup(REQUIRES 6.5) + qt_add_executable(qml_pixelator + WIN32 + MACOSX_BUNDLE imagemodel.cpp imagemodel.h main.cpp ) -set_target_properties(qml_pixelator PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(qml_pixelator PUBLIC - Qt::Core - Qt::Gui - Qt::Qml - Qt::Quick +target_link_libraries(qml_pixelator PRIVATE + Qt6::Core + Qt6::Gui + Qt6::Qml + Qt6::Quick ) qt_add_qml_module(qml_pixelator @@ -39,7 +32,16 @@ qt_add_qml_module(qml_pixelator ) install(TARGETS qml_pixelator - 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_qml_app_script( + TARGET qml_pixelator + OUTPUT_SCRIPT deploy_script + MACOS_BUNDLE_POST_BUILD + NO_UNSUPPORTED_PLATFORM_ERROR + DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM ) +install(SCRIPT ${deploy_script}) diff --git a/examples/quick/tableview/pixelator/doc/src/pixelator.qdoc b/examples/quick/tableview/pixelator/doc/src/pixelator.qdoc index 552b70e198..35d3ac6732 100644 --- a/examples/quick/tableview/pixelator/doc/src/pixelator.qdoc +++ b/examples/quick/tableview/pixelator/doc/src/pixelator.qdoc @@ -5,6 +5,7 @@ \example tableview/pixelator \brief The Pixelator example shows how a QML TableView and a delegate can be used for custom table models. + \examplecategory {Graphics} \image qt-pixelator.png \ingroup qtquickexamples |