summaryrefslogtreecommitdiffstats
path: root/examples/widgets/painting/painterpaths
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/painting/painterpaths')
-rw-r--r--examples/widgets/painting/painterpaths/CMakeLists.txt36
-rw-r--r--examples/widgets/painting/painterpaths/window.cpp10
2 files changed, 25 insertions, 21 deletions
diff --git a/examples/widgets/painting/painterpaths/CMakeLists.txt b/examples/widgets/painting/painterpaths/CMakeLists.txt
index fde9403554..46f7948277 100644
--- a/examples/widgets/painting/painterpaths/CMakeLists.txt
+++ b/examples/widgets/painting/painterpaths/CMakeLists.txt
@@ -1,16 +1,13 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(painterpaths LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/painterpaths")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(painterpaths
main.cpp
renderarea.cpp renderarea.h
@@ -22,20 +19,27 @@ set_target_properties(painterpaths PROPERTIES
MACOSX_BUNDLE TRUE
)
-target_link_libraries(painterpaths PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+target_link_libraries(painterpaths PRIVATE
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
if(UNIX AND NOT APPLE AND NOT HAIKU AND NOT INTEGRITY AND NOT VXWORKS)
- target_link_libraries(painterpaths PUBLIC
+ target_link_libraries(painterpaths PRIVATE
m
)
endif()
install(TARGETS painterpaths
- 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 painterpaths
+ OUTPUT_SCRIPT deploy_script
+ NO_UNSUPPORTED_PLATFORM_ERROR
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/widgets/painting/painterpaths/window.cpp b/examples/widgets/painting/painterpaths/window.cpp
index 4fc3e8efd9..01b62d6988 100644
--- a/examples/widgets/painting/painterpaths/window.cpp
+++ b/examples/widgets/painting/painterpaths/window.cpp
@@ -156,7 +156,7 @@ Window::Window()
connect(penColorComboBox, &QComboBox::activated,
this, &Window::penColorChanged);
- for (RenderArea *area : qAsConst(renderAreas)) {
+ for (RenderArea *area : std::as_const(renderAreas)) {
connect(penWidthSpinBox, &QSpinBox::valueChanged,
area, &RenderArea::setPenWidth);
connect(rotationAngleSpinBox, &QSpinBox::valueChanged,
@@ -167,7 +167,7 @@ Window::Window()
QGridLayout *topLayout = new QGridLayout;
int i = 0;
- for (RenderArea *area : qAsConst(renderAreas)) {
+ for (RenderArea *area : std::as_const(renderAreas)) {
topLayout->addWidget(area, i / 3, i % 3);
++i;
}
@@ -204,7 +204,7 @@ void Window::fillRuleChanged()
{
Qt::FillRule rule = (Qt::FillRule)currentItemData(fillRuleComboBox).toInt();
- for (RenderArea *area : qAsConst(renderAreas))
+ for (RenderArea *area : std::as_const(renderAreas))
area->setFillRule(rule);
}
//! [19]
@@ -215,7 +215,7 @@ void Window::fillGradientChanged()
QColor color1 = qvariant_cast<QColor>(currentItemData(fillColor1ComboBox));
QColor color2 = qvariant_cast<QColor>(currentItemData(fillColor2ComboBox));
- for (RenderArea *area : qAsConst(renderAreas))
+ for (RenderArea *area : std::as_const(renderAreas))
area->setFillGradient(color1, color2);
}
//! [20]
@@ -225,7 +225,7 @@ void Window::penColorChanged()
{
QColor color = qvariant_cast<QColor>(currentItemData(penColorComboBox));
- for (RenderArea *area : qAsConst(renderAreas))
+ for (RenderArea *area : std::as_const(renderAreas))
area->setPenColor(color);
}
//! [21]