summaryrefslogtreecommitdiffstats
path: root/examples/widgets/graphicsview
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/graphicsview')
-rw-r--r--examples/widgets/graphicsview/CMakeLists.txt4
-rw-r--r--examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt21
-rw-r--r--examples/widgets/graphicsview/chip/CMakeLists.txt21
-rw-r--r--examples/widgets/graphicsview/chip/main.cpp2
-rw-r--r--examples/widgets/graphicsview/chip/mainwindow.cpp3
-rw-r--r--examples/widgets/graphicsview/collidingmice/CMakeLists.txt21
-rw-r--r--examples/widgets/graphicsview/diagramscene/CMakeLists.txt21
-rw-r--r--examples/widgets/graphicsview/diagramscene/main.cpp2
-rw-r--r--examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt21
-rw-r--r--examples/widgets/graphicsview/elasticnodes/CMakeLists.txt21
-rw-r--r--examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt50
-rw-r--r--examples/widgets/graphicsview/embeddeddialogs/No-Ones-Laughing-3.jpgbin30730 -> 0 bytes
-rw-r--r--examples/widgets/graphicsview/embeddeddialogs/customproxy.cpp133
-rw-r--r--examples/widgets/graphicsview/embeddeddialogs/customproxy.h39
-rw-r--r--examples/widgets/graphicsview/embeddeddialogs/embeddeddialog.cpp70
-rw-r--r--examples/widgets/graphicsview/embeddeddialogs/embeddeddialog.h33
-rw-r--r--examples/widgets/graphicsview/embeddeddialogs/embeddeddialog.ui88
-rw-r--r--examples/widgets/graphicsview/embeddeddialogs/embeddeddialogs.pro18
-rw-r--r--examples/widgets/graphicsview/embeddeddialogs/embeddeddialogs.qrc5
-rw-r--r--examples/widgets/graphicsview/embeddeddialogs/main.cpp43
-rw-r--r--examples/widgets/graphicsview/flowlayout/CMakeLists.txt38
-rw-r--r--examples/widgets/graphicsview/flowlayout/flowlayout.cpp170
-rw-r--r--examples/widgets/graphicsview/flowlayout/flowlayout.h44
-rw-r--r--examples/widgets/graphicsview/flowlayout/flowlayout.pro10
-rw-r--r--examples/widgets/graphicsview/flowlayout/main.cpp24
-rw-r--r--examples/widgets/graphicsview/flowlayout/window.cpp24
-rw-r--r--examples/widgets/graphicsview/flowlayout/window.h16
-rw-r--r--examples/widgets/graphicsview/graphicsview.pro2
-rw-r--r--examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt21
29 files changed, 78 insertions, 887 deletions
diff --git a/examples/widgets/graphicsview/CMakeLists.txt b/examples/widgets/graphicsview/CMakeLists.txt
index e0d291312e..7e287f0f42 100644
--- a/examples/widgets/graphicsview/CMakeLists.txt
+++ b/examples/widgets/graphicsview/CMakeLists.txt
@@ -1,13 +1,11 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
qt_internal_add_example(chip)
qt_internal_add_example(elasticnodes)
-qt_internal_add_example(embeddeddialogs)
qt_internal_add_example(collidingmice)
qt_internal_add_example(basicgraphicslayouts)
qt_internal_add_example(diagramscene)
-qt_internal_add_example(flowlayout)
qt_internal_add_example(simpleanchorlayout)
if(QT_FEATURE_cursor AND QT_FEATURE_draganddrop)
qt_internal_add_example(dragdroprobot)
diff --git a/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt b/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt
index 6ee7426ace..dae3884e8b 100644
--- a/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt
+++ b/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt
@@ -1,15 +1,9 @@
# 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(basicgraphicslayouts LANGUAGES CXX)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/basicgraphicslayouts")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_standard_project_setup()
@@ -44,7 +38,14 @@ qt_add_resources(basicgraphicslayouts "basicgraphicslayouts"
)
install(TARGETS basicgraphicslayouts
- 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 basicgraphicslayouts
+ OUTPUT_SCRIPT deploy_script
+ NO_UNSUPPORTED_PLATFORM_ERROR
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/widgets/graphicsview/chip/CMakeLists.txt b/examples/widgets/graphicsview/chip/CMakeLists.txt
index 03305cf92c..81b2e19552 100644
--- a/examples/widgets/graphicsview/chip/CMakeLists.txt
+++ b/examples/widgets/graphicsview/chip/CMakeLists.txt
@@ -1,15 +1,9 @@
# 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(chip LANGUAGES CXX)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/chip")
-
find_package(Qt6
REQUIRED COMPONENTS Core Gui Widgets
OPTIONAL_COMPONENTS PrintSupport
@@ -57,7 +51,14 @@ if(TARGET Qt6::PrintSupport)
endif()
install(TARGETS chip
- 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 chip
+ OUTPUT_SCRIPT deploy_script
+ NO_UNSUPPORTED_PLATFORM_ERROR
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/widgets/graphicsview/chip/main.cpp b/examples/widgets/graphicsview/chip/main.cpp
index bf75db6a93..4ccd66bbb9 100644
--- a/examples/widgets/graphicsview/chip/main.cpp
+++ b/examples/widgets/graphicsview/chip/main.cpp
@@ -7,8 +7,6 @@
int main(int argc, char *argv[])
{
- Q_INIT_RESOURCE(images);
-
QApplication app(argc, argv);
app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
diff --git a/examples/widgets/graphicsview/chip/mainwindow.cpp b/examples/widgets/graphicsview/chip/mainwindow.cpp
index 00de1d852e..8b4f5b27fd 100644
--- a/examples/widgets/graphicsview/chip/mainwindow.cpp
+++ b/examples/widgets/graphicsview/chip/mainwindow.cpp
@@ -48,7 +48,6 @@ void MainWindow::populateScene()
// Populate scene
int xx = 0;
- int nitems = 0;
for (int i = -11000; i < 11000; i += 110) {
++xx;
int yy = 0;
@@ -61,8 +60,6 @@ void MainWindow::populateScene()
QGraphicsItem *item = new Chip(color, xx, yy);
item->setPos(QPointF(i, j));
scene->addItem(item);
-
- ++nitems;
}
}
}
diff --git a/examples/widgets/graphicsview/collidingmice/CMakeLists.txt b/examples/widgets/graphicsview/collidingmice/CMakeLists.txt
index ec31b3bcbf..226b72b051 100644
--- a/examples/widgets/graphicsview/collidingmice/CMakeLists.txt
+++ b/examples/widgets/graphicsview/collidingmice/CMakeLists.txt
@@ -1,15 +1,9 @@
# 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(collidingmice LANGUAGES CXX)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/collidingmice")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_standard_project_setup()
@@ -43,7 +37,14 @@ qt_add_resources(collidingmice "mice"
)
install(TARGETS collidingmice
- 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 collidingmice
+ OUTPUT_SCRIPT deploy_script
+ NO_UNSUPPORTED_PLATFORM_ERROR
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/widgets/graphicsview/diagramscene/CMakeLists.txt b/examples/widgets/graphicsview/diagramscene/CMakeLists.txt
index 16c797c455..9db835478d 100644
--- a/examples/widgets/graphicsview/diagramscene/CMakeLists.txt
+++ b/examples/widgets/graphicsview/diagramscene/CMakeLists.txt
@@ -1,15 +1,9 @@
# 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(diagramscene LANGUAGES CXX)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/diagramscene")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_standard_project_setup()
@@ -61,7 +55,14 @@ qt_add_resources(diagramscene "diagramscene"
)
install(TARGETS diagramscene
- 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 diagramscene
+ OUTPUT_SCRIPT deploy_script
+ NO_UNSUPPORTED_PLATFORM_ERROR
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/widgets/graphicsview/diagramscene/main.cpp b/examples/widgets/graphicsview/diagramscene/main.cpp
index 56310b1751..699c33f079 100644
--- a/examples/widgets/graphicsview/diagramscene/main.cpp
+++ b/examples/widgets/graphicsview/diagramscene/main.cpp
@@ -7,8 +7,6 @@
int main(int argv, char *args[])
{
- Q_INIT_RESOURCE(diagramscene);
-
QApplication app(argv, args);
MainWindow mainWindow;
mainWindow.setGeometry(100, 100, 800, 500);
diff --git a/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt b/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt
index b6a39c4bce..df2425260e 100644
--- a/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt
+++ b/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt
@@ -1,15 +1,9 @@
# 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(dragdroprobot LANGUAGES CXX)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/dragdroprobot")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_standard_project_setup()
@@ -44,7 +38,14 @@ qt_add_resources(dragdroprobot "robot"
)
install(TARGETS dragdroprobot
- 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 dragdroprobot
+ OUTPUT_SCRIPT deploy_script
+ NO_UNSUPPORTED_PLATFORM_ERROR
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt b/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt
index b0378b3146..07299cd5a7 100644
--- a/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt
+++ b/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt
@@ -1,15 +1,9 @@
# 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(elasticnodes LANGUAGES CXX)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/elasticnodes")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_standard_project_setup()
@@ -33,7 +27,14 @@ target_link_libraries(elasticnodes PRIVATE
)
install(TARGETS elasticnodes
- 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 elasticnodes
+ OUTPUT_SCRIPT deploy_script
+ NO_UNSUPPORTED_PLATFORM_ERROR
)
+install(SCRIPT ${deploy_script})
diff --git a/examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt b/examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt
deleted file mode 100644
index 78883a0a89..0000000000
--- a/examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(embeddeddialogs LANGUAGES CXX)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/embeddeddialogs")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
-
-qt_standard_project_setup()
-
-qt_add_executable(embeddeddialogs
- customproxy.cpp customproxy.h
- embeddeddialog.cpp embeddeddialog.h embeddeddialog.ui
- main.cpp
-)
-
-set_target_properties(embeddeddialogs PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-target_link_libraries(embeddeddialogs PRIVATE
- Qt6::Core
- Qt6::Gui
- Qt6::Widgets
-)
-
-# Resources:
-set(embeddeddialogs_resource_files
- "No-Ones-Laughing-3.jpg"
-)
-
-qt_add_resources(embeddeddialogs "embeddeddialogs"
- PREFIX
- "/"
- FILES
- ${embeddeddialogs_resource_files}
-)
-
-install(TARGETS embeddeddialogs
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/graphicsview/embeddeddialogs/No-Ones-Laughing-3.jpg b/examples/widgets/graphicsview/embeddeddialogs/No-Ones-Laughing-3.jpg
deleted file mode 100644
index 445567fbda..0000000000
--- a/examples/widgets/graphicsview/embeddeddialogs/No-Ones-Laughing-3.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/graphicsview/embeddeddialogs/customproxy.cpp b/examples/widgets/graphicsview/embeddeddialogs/customproxy.cpp
deleted file mode 100644
index 57a104f57d..0000000000
--- a/examples/widgets/graphicsview/embeddeddialogs/customproxy.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "customproxy.h"
-
-#include <QGraphicsScene>
-#include <QPainter>
-#include <QStyleOptionGraphicsItem>
-
-CustomProxy::CustomProxy(QGraphicsItem *parent, Qt::WindowFlags wFlags)
- : QGraphicsProxyWidget(parent, wFlags), timeLine(new QTimeLine(250, this))
-{
- connect(timeLine, &QTimeLine::valueChanged,
- this, &CustomProxy::updateStep);
- connect(timeLine, &QTimeLine::stateChanged,
- this, &CustomProxy::stateChanged);
-}
-
-QRectF CustomProxy::boundingRect() const
-{
- return QGraphicsProxyWidget::boundingRect().adjusted(0, 0, 10, 10);
-}
-
-void CustomProxy::paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget)
-{
- const QColor color(0, 0, 0, 64);
-
- QRectF r = windowFrameRect();
- QRectF right(r.right(), r.top() + 10, 10, r.height() - 10);
- QRectF bottom(r.left() + 10, r.bottom(), r.width(), 10);
- bool intersectsRight = right.intersects(option->exposedRect);
- bool intersectsBottom = bottom.intersects(option->exposedRect);
- if (intersectsRight && intersectsBottom) {
- QPainterPath path;
- path.addRect(right);
- path.addRect(bottom);
- painter->setPen(Qt::NoPen);
- painter->setBrush(color);
- painter->drawPath(path);
- } else if (intersectsBottom) {
- painter->fillRect(bottom, color);
- } else if (intersectsRight) {
- painter->fillRect(right, color);
- }
-
- QGraphicsProxyWidget::paintWindowFrame(painter, option, widget);
-}
-
-void CustomProxy::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
-{
- QGraphicsProxyWidget::hoverEnterEvent(event);
- scene()->setActiveWindow(this);
- if (qFuzzyCompare(timeLine->currentValue(), 1))
- zoomIn();
-}
-
-void CustomProxy::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
-{
- QGraphicsProxyWidget::hoverLeaveEvent(event);
- if (!popupShown
- && (timeLine->direction() != QTimeLine::Backward || qFuzzyIsNull(timeLine->currentValue()))) {
- zoomOut();
- }
-}
-
-bool CustomProxy::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
-{
- if (watched->isWindow()
- && (event->type() == QEvent::UngrabMouse || event->type() == QEvent::GrabMouse)) {
- popupShown = watched->isVisible();
- if (!popupShown && !isUnderMouse())
- zoomOut();
- }
- return QGraphicsProxyWidget::sceneEventFilter(watched, event);
-}
-
-QVariant CustomProxy::itemChange(GraphicsItemChange change, const QVariant &value)
-{
- if (change == ItemChildAddedChange || change == ItemChildRemovedChange) {
- if (change == ItemChildAddedChange) {
- currentPopup = qvariant_cast<QGraphicsItem *>(value);
- currentPopup->setCacheMode(ItemCoordinateCache);
- if (scene())
- currentPopup->installSceneEventFilter(this);
- } else if (scene()) {
- currentPopup->removeSceneEventFilter(this);
- currentPopup = nullptr;
- }
- } else if (currentPopup && change == ItemSceneHasChanged) {
- currentPopup->installSceneEventFilter(this);
- }
- return QGraphicsProxyWidget::itemChange(change, value);
-}
-
-void CustomProxy::updateStep(qreal step)
-{
- QRectF r = boundingRect();
- setTransform(QTransform()
- .translate(r.width() / 2, r.height() / 2)
- .rotate(step * 30, Qt::XAxis)
- .rotate(step * 10, Qt::YAxis)
- .rotate(step * 5, Qt::ZAxis)
- .scale(1 + 1.5 * step, 1 + 1.5 * step)
- .translate(-r.width() / 2, -r.height() / 2));
-}
-
-void CustomProxy::stateChanged(QTimeLine::State state)
-{
- if (state == QTimeLine::Running) {
- if (timeLine->direction() == QTimeLine::Forward)
- setCacheMode(ItemCoordinateCache);
- } else if (state == QTimeLine::NotRunning) {
- if (timeLine->direction() == QTimeLine::Backward)
- setCacheMode(DeviceCoordinateCache);
- }
-}
-
-void CustomProxy::zoomIn()
-{
- if (timeLine->direction() != QTimeLine::Forward)
- timeLine->setDirection(QTimeLine::Forward);
- if (timeLine->state() == QTimeLine::NotRunning)
- timeLine->start();
-}
-
-void CustomProxy::zoomOut()
-{
- if (timeLine->direction() != QTimeLine::Backward)
- timeLine->setDirection(QTimeLine::Backward);
- if (timeLine->state() == QTimeLine::NotRunning)
- timeLine->start();
-}
diff --git a/examples/widgets/graphicsview/embeddeddialogs/customproxy.h b/examples/widgets/graphicsview/embeddeddialogs/customproxy.h
deleted file mode 100644
index 444d39e73e..0000000000
--- a/examples/widgets/graphicsview/embeddeddialogs/customproxy.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef CUSTOMPROXY_H
-#define CUSTOMPROXY_H
-
-#include <QTimeLine>
-#include <QGraphicsProxyWidget>
-
-class CustomProxy : public QGraphicsProxyWidget
-{
- Q_OBJECT
-
-public:
- explicit CustomProxy(QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = { });
-
- QRectF boundingRect() const override;
- void paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget) override;
-
-protected:
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
- bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override;
- QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
-
-private slots:
- void updateStep(qreal step);
- void stateChanged(QTimeLine::State);
- void zoomIn();
- void zoomOut();
-
-private:
- QTimeLine *timeLine;
- QGraphicsItem *currentPopup = nullptr;
- bool popupShown = false;
-};
-
-#endif // CUSTOMPROXY_H
diff --git a/examples/widgets/graphicsview/embeddeddialogs/embeddeddialog.cpp b/examples/widgets/graphicsview/embeddeddialogs/embeddeddialog.cpp
deleted file mode 100644
index 43d7fbf1e9..0000000000
--- a/examples/widgets/graphicsview/embeddeddialogs/embeddeddialog.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "embeddeddialog.h"
-#include "ui_embeddeddialog.h"
-
-#include <QStyleFactory>
-
-EmbeddedDialog::EmbeddedDialog(QWidget *parent)
- : QDialog(parent)
- , ui(new Ui::EmbeddedDialog)
-{
- ui->setupUi(this);
- ui->layoutDirection->setCurrentIndex(layoutDirection() != Qt::LeftToRight);
-
- const QStringList styleKeys = QStyleFactory::keys();
- for (const QString &styleName : styleKeys) {
- ui->style->addItem(styleName);
- if (style()->objectName().toLower() == styleName.toLower())
- ui->style->setCurrentIndex(ui->style->count() - 1);
- }
-
- connect(ui->layoutDirection, &QComboBox::activated,
- this, &EmbeddedDialog::layoutDirectionChanged);
- connect(ui->spacing, &QSlider::valueChanged,
- this, &EmbeddedDialog::spacingChanged);
- connect(ui->fontComboBox, &QFontComboBox::currentFontChanged,
- this, &EmbeddedDialog::fontChanged);
- connect(ui->style, &QComboBox::textActivated,
- this, &EmbeddedDialog::styleChanged);
-}
-
-EmbeddedDialog::~EmbeddedDialog()
-{
- delete ui;
-}
-
-void EmbeddedDialog::layoutDirectionChanged(int index)
-{
- setLayoutDirection(index == 0 ? Qt::LeftToRight : Qt::RightToLeft);
-}
-
-void EmbeddedDialog::spacingChanged(int spacing)
-{
- layout()->setSpacing(spacing);
- adjustSize();
-}
-
-void EmbeddedDialog::fontChanged(const QFont &font)
-{
- setFont(font);
-}
-
-static void setStyleHelper(QWidget *widget, QStyle *style)
-{
- widget->setStyle(style);
- widget->setPalette(style->standardPalette());
- const QObjectList children = widget->children();
- for (QObject *child : children) {
- if (QWidget *childWidget = qobject_cast<QWidget *>(child))
- setStyleHelper(childWidget, style);
- }
-}
-
-void EmbeddedDialog::styleChanged(const QString &styleName)
-{
- QStyle *style = QStyleFactory::create(styleName);
- if (style)
- setStyleHelper(this, style);
-}
diff --git a/examples/widgets/graphicsview/embeddeddialogs/embeddeddialog.h b/examples/widgets/graphicsview/embeddeddialogs/embeddeddialog.h
deleted file mode 100644
index d4c561799e..0000000000
--- a/examples/widgets/graphicsview/embeddeddialogs/embeddeddialog.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef EMBEDDEDDIALOG_H
-#define EMBEDDEDDIALOG_H
-
-#include <QDialog>
-
-QT_BEGIN_NAMESPACE
-namespace Ui {
-class EmbeddedDialog;
-}
-QT_END_NAMESPACE
-
-class EmbeddedDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- EmbeddedDialog(QWidget *parent = nullptr);
- ~EmbeddedDialog();
-
-private slots:
- void layoutDirectionChanged(int index);
- void spacingChanged(int spacing);
- void fontChanged(const QFont &font);
- void styleChanged(const QString &styleName);
-
-private:
- Ui::EmbeddedDialog *ui;
-};
-
-#endif // EMBEDDEDDIALOG_H
diff --git a/examples/widgets/graphicsview/embeddeddialogs/embeddeddialog.ui b/examples/widgets/graphicsview/embeddeddialogs/embeddeddialog.ui
deleted file mode 100644
index 82aa5d7be3..0000000000
--- a/examples/widgets/graphicsview/embeddeddialogs/embeddeddialog.ui
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>EmbeddedDialog</class>
- <widget class="QDialog" name="EmbeddedDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>407</width>
- <height>134</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Embedded Dialog</string>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Layout Direction:</string>
- </property>
- <property name="buddy">
- <cstring>layoutDirection</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="layoutDirection">
- <item>
- <property name="text">
- <string>Left to Right</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Right to Left</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Select Font:</string>
- </property>
- <property name="buddy">
- <cstring>fontComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QFontComboBox" name="fontComboBox"/>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Style:</string>
- </property>
- <property name="buddy">
- <cstring>style</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QComboBox" name="style"/>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Layout spacing:</string>
- </property>
- <property name="buddy">
- <cstring>spacing</cstring>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QSlider" name="spacing">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/examples/widgets/graphicsview/embeddeddialogs/embeddeddialogs.pro b/examples/widgets/graphicsview/embeddeddialogs/embeddeddialogs.pro
deleted file mode 100644
index 60c507fc3d..0000000000
--- a/examples/widgets/graphicsview/embeddeddialogs/embeddeddialogs.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-QT += widgets
-requires(qtConfig(fontcombobox))
-
-SOURCES += main.cpp
-SOURCES += customproxy.cpp embeddeddialog.cpp
-HEADERS += customproxy.h embeddeddialog.h
-
-FORMS += embeddeddialog.ui
-RESOURCES += embeddeddialogs.qrc
-
-build_all:!build_pass {
- CONFIG -= build_all
- CONFIG += release
-}
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/graphicsview/embeddeddialogs
-INSTALLS += target
diff --git a/examples/widgets/graphicsview/embeddeddialogs/embeddeddialogs.qrc b/examples/widgets/graphicsview/embeddeddialogs/embeddeddialogs.qrc
deleted file mode 100644
index 33be5038da..0000000000
--- a/examples/widgets/graphicsview/embeddeddialogs/embeddeddialogs.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource>
- <file>No-Ones-Laughing-3.jpg</file>
- </qresource>
-</RCC>
diff --git a/examples/widgets/graphicsview/embeddeddialogs/main.cpp b/examples/widgets/graphicsview/embeddeddialogs/main.cpp
deleted file mode 100644
index f022b74814..0000000000
--- a/examples/widgets/graphicsview/embeddeddialogs/main.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "customproxy.h"
-#include "embeddeddialog.h"
-
-#include <QApplication>
-#include <QGraphicsScene>
-#include <QGraphicsView>
-
-int main(int argc, char *argv[])
-{
- Q_INIT_RESOURCE(embeddeddialogs);
- QApplication app(argc, argv);
-
- QGraphicsScene scene;
- scene.setStickyFocus(true);
- const int gridSize = 10;
-
- for (int y = 0; y < gridSize; ++y) {
- for (int x = 0; x < gridSize; ++x) {
- CustomProxy *proxy = new CustomProxy(nullptr, Qt::Window);
- proxy->setWidget(new EmbeddedDialog);
-
- QRectF rect = proxy->boundingRect();
-
- proxy->setPos(x * rect.width() * 1.05, y * rect.height() * 1.05);
- proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
-
- scene.addItem(proxy);
- }
- }
- scene.setSceneRect(scene.itemsBoundingRect());
-
- QGraphicsView view(&scene);
- view.scale(0.5, 0.5);
- view.setRenderHints(view.renderHints() | QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
- view.setBackgroundBrush(QPixmap(":/No-Ones-Laughing-3.jpg"));
- view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
- view.show();
- view.setWindowTitle("Embedded Dialogs Example");
- return app.exec();
-}
diff --git a/examples/widgets/graphicsview/flowlayout/CMakeLists.txt b/examples/widgets/graphicsview/flowlayout/CMakeLists.txt
deleted file mode 100644
index b15af3d02d..0000000000
--- a/examples/widgets/graphicsview/flowlayout/CMakeLists.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(flowlayout LANGUAGES CXX)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview_flowlayout")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
-
-qt_standard_project_setup()
-
-qt_add_executable(graphicsview_flowlayout
- flowlayout.cpp flowlayout.h
- main.cpp
- window.cpp window.h
-)
-
-set_target_properties(graphicsview_flowlayout PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-target_link_libraries(graphicsview_flowlayout PRIVATE
- Qt6::Core
- Qt6::Gui
- Qt6::Widgets
-)
-
-install(TARGETS graphicsview_flowlayout
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/graphicsview/flowlayout/flowlayout.cpp b/examples/widgets/graphicsview/flowlayout/flowlayout.cpp
deleted file mode 100644
index ab5f4717b3..0000000000
--- a/examples/widgets/graphicsview/flowlayout/flowlayout.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "flowlayout.h"
-
-#include <QtMath>
-
-FlowLayout::FlowLayout(QGraphicsLayoutItem *parent) : QGraphicsLayout(parent)
-{
- QSizePolicy sp = sizePolicy();
- sp.setHeightForWidth(true);
- setSizePolicy(sp);
-}
-
-void FlowLayout::insertItem(int index, QGraphicsLayoutItem *item)
-{
- item->setParentLayoutItem(this);
- if (index > m_items.count() || index < 0)
- index = m_items.count();
- m_items.insert(index, item);
- invalidate();
-}
-
-int FlowLayout::count() const
-{
- return m_items.count();
-}
-
-QGraphicsLayoutItem *FlowLayout::itemAt(int index) const
-{
- return m_items.value(index);
-}
-
-void FlowLayout::removeAt(int index)
-{
- m_items.removeAt(index);
- invalidate();
-}
-
-qreal FlowLayout::spacing(Qt::Orientation o) const
-{
- return m_spacing[int(o) - 1];
-}
-
-void FlowLayout::setSpacing(Qt::Orientations o, qreal spacing)
-{
- if (o & Qt::Horizontal)
- m_spacing[0] = spacing;
- if (o & Qt::Vertical)
- m_spacing[1] = spacing;
-}
-
-void FlowLayout::setGeometry(const QRectF &geom)
-{
- QGraphicsLayout::setGeometry(geom);
- doLayout(geom, true);
-}
-
-qreal FlowLayout::doLayout(const QRectF &geom, bool applyNewGeometry) const
-{
- qreal left, top, right, bottom;
- getContentsMargins(&left, &top, &right, &bottom);
- const qreal maxw = geom.width() - left - right;
-
- qreal x = 0;
- qreal y = 0;
- qreal maxRowHeight = 0;
- QSizeF pref;
- for (QGraphicsLayoutItem *item : m_items) {
- pref = item->effectiveSizeHint(Qt::PreferredSize);
- maxRowHeight = qMax(maxRowHeight, pref.height());
-
- qreal next_x;
- next_x = x + pref.width();
- if (next_x > maxw) {
- if (qFuzzyIsNull(x)) {
- pref.setWidth(maxw);
- } else {
- x = 0;
- next_x = pref.width();
- }
- y += maxRowHeight + spacing(Qt::Vertical);
- maxRowHeight = 0;
- }
-
- if (applyNewGeometry)
- item->setGeometry(QRectF(QPointF(left + x, top + y), pref));
- x = next_x + spacing(Qt::Horizontal);
- }
- maxRowHeight = qMax(maxRowHeight, pref.height());
- return top + y + maxRowHeight + bottom;
-}
-
-QSizeF FlowLayout::minSize(const QSizeF &constraint) const
-{
- QSizeF size(0, 0);
- qreal left, top, right, bottom;
- getContentsMargins(&left, &top, &right, &bottom);
- if (constraint.width() >= 0) { // height for width
- const qreal height = doLayout(QRectF(QPointF(0,0), constraint), false);
- size = QSizeF(constraint.width(), height);
- } else if (constraint.height() >= 0) { // width for height?
- // not supported
- } else {
- for (const QGraphicsLayoutItem *item : std::as_const(m_items))
- size = size.expandedTo(item->effectiveSizeHint(Qt::MinimumSize));
- size += QSizeF(left + right, top + bottom);
- }
- return size;
-}
-
-QSizeF FlowLayout::prefSize() const
-{
- qreal left, right;
- getContentsMargins(&left, nullptr, &right, nullptr);
-
- qreal maxh = 0;
- qreal totalWidth = 0;
- for (const QGraphicsLayoutItem *item : std::as_const(m_items)) {
- if (totalWidth > 0)
- totalWidth += spacing(Qt::Horizontal);
- QSizeF pref = item->effectiveSizeHint(Qt::PreferredSize);
- totalWidth += pref.width();
- maxh = qMax(maxh, pref.height());
- }
- maxh += spacing(Qt::Vertical);
-
- const qreal goldenAspectRatio = 1.61803399;
- qreal w = qSqrt(totalWidth * maxh * goldenAspectRatio) + left + right;
-
- return minSize(QSizeF(w, -1));
-}
-
-QSizeF FlowLayout::maxSize() const
-{
- qreal totalWidth = 0;
- qreal totalHeight = 0;
- for (const QGraphicsLayoutItem *item : std::as_const(m_items)) {
- if (totalWidth > 0)
- totalWidth += spacing(Qt::Horizontal);
- if (totalHeight > 0)
- totalHeight += spacing(Qt::Vertical);
- QSizeF pref = item->effectiveSizeHint(Qt::PreferredSize);
- totalWidth += pref.width();
- totalHeight += pref.height();
- }
-
- qreal left, top, right, bottom;
- getContentsMargins(&left, &top, &right, &bottom);
- return QSizeF(left + totalWidth + right, top + totalHeight + bottom);
-}
-
-QSizeF FlowLayout::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- QSizeF sh = constraint;
- switch (which) {
- case Qt::PreferredSize:
- sh = prefSize();
- break;
- case Qt::MinimumSize:
- sh = minSize(constraint);
- break;
- case Qt::MaximumSize:
- sh = maxSize();
- break;
- default:
- break;
- }
- return sh;
-}
diff --git a/examples/widgets/graphicsview/flowlayout/flowlayout.h b/examples/widgets/graphicsview/flowlayout/flowlayout.h
deleted file mode 100644
index 028394827a..0000000000
--- a/examples/widgets/graphicsview/flowlayout/flowlayout.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef FLOWLAYOUT_H
-#define FLOWLAYOUT_H
-
-#include <QGraphicsLayout>
-
-class FlowLayout : public QGraphicsLayout
-{
-public:
- FlowLayout(QGraphicsLayoutItem *parent = nullptr);
- inline void addItem(QGraphicsLayoutItem *item);
- void insertItem(int index, QGraphicsLayoutItem *item);
- void setSpacing(Qt::Orientations o, qreal spacing);
- qreal spacing(Qt::Orientation o) const;
-
- // inherited functions
- void setGeometry(const QRectF &geom) override;
-
- int count() const override;
- QGraphicsLayoutItem *itemAt(int index) const override;
- void removeAt(int index) override;
-
-protected:
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
-
-private:
- qreal doLayout(const QRectF &geom, bool applyNewGeometry) const;
- QSizeF minSize(const QSizeF &constraint) const;
- QSizeF prefSize() const;
- QSizeF maxSize() const;
-
- QList<QGraphicsLayoutItem *> m_items;
- qreal m_spacing[2] = {6, 6};
-};
-
-
-inline void FlowLayout::addItem(QGraphicsLayoutItem *item)
-{
- insertItem(-1, item);
-}
-
-#endif // FLOWLAYOUT_H
diff --git a/examples/widgets/graphicsview/flowlayout/flowlayout.pro b/examples/widgets/graphicsview/flowlayout/flowlayout.pro
deleted file mode 100644
index 7830e3a008..0000000000
--- a/examples/widgets/graphicsview/flowlayout/flowlayout.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-QT += widgets
-
-QMAKE_PROJECT_NAME = flowlayout_graphicsview
-
-HEADERS += flowlayout.h window.h
-SOURCES += flowlayout.cpp main.cpp window.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/graphicsview/flowlayout
-INSTALLS += target
diff --git a/examples/widgets/graphicsview/flowlayout/main.cpp b/examples/widgets/graphicsview/flowlayout/main.cpp
deleted file mode 100644
index 118b404870..0000000000
--- a/examples/widgets/graphicsview/flowlayout/main.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-//! [1]
-#include "window.h"
-
-#include <QApplication>
-#include <QGraphicsView>
-
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- QGraphicsScene scene;
- QGraphicsView view(&scene);
- Window *w = new Window;
- scene.addItem(w);
-
- view.resize(400, 300);
- view.show();
-
- return app.exec();
-}
-//! [1]
diff --git a/examples/widgets/graphicsview/flowlayout/window.cpp b/examples/widgets/graphicsview/flowlayout/window.cpp
deleted file mode 100644
index ed9a5720d3..0000000000
--- a/examples/widgets/graphicsview/flowlayout/window.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "window.h"
-#include "flowlayout.h"
-
-#include <QGraphicsProxyWidget>
-#include <QLabel>
-
-Window::Window(QGraphicsItem *parent) : QGraphicsWidget(parent, Qt::Window)
-{
- FlowLayout *lay = new FlowLayout;
- const QString sentence(QLatin1String("I am not bothered by the fact that I am unknown."
- " I am bothered when I do not know others. (Confucius)"));
- const QList<QStringView> words = QStringView{ sentence }.split(QLatin1Char(' '), Qt::SkipEmptyParts);
- for (const QStringView &word : words) {
- QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(this);
- QLabel *label = new QLabel(word.toString());
- label->setFrameStyle(QFrame::Box | QFrame::Plain);
- proxy->setWidget(label);
- lay->addItem(proxy);
- }
- setLayout(lay);
-}
diff --git a/examples/widgets/graphicsview/flowlayout/window.h b/examples/widgets/graphicsview/flowlayout/window.h
deleted file mode 100644
index 2fc5570406..0000000000
--- a/examples/widgets/graphicsview/flowlayout/window.h
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef WINDOW_H
-#define WINDOW_H
-
-#include <QGraphicsWidget>
-
-class Window : public QGraphicsWidget
-{
- Q_OBJECT
-public:
- Window(QGraphicsItem *parent = nullptr);
-};
-
-#endif // WINDOW_H
diff --git a/examples/widgets/graphicsview/graphicsview.pro b/examples/widgets/graphicsview/graphicsview.pro
index b3e49050ba..d50f0b1adc 100644
--- a/examples/widgets/graphicsview/graphicsview.pro
+++ b/examples/widgets/graphicsview/graphicsview.pro
@@ -2,12 +2,10 @@ TEMPLATE = subdirs
SUBDIRS = \
chip \
elasticnodes \
- embeddeddialogs \
collidingmice \
basicgraphicslayouts \
diagramscene \
dragdroprobot \
- flowlayout \
simpleanchorlayout
contains(DEFINES, QT_NO_CURSOR)|!qtConfig(draganddrop): SUBDIRS -= dragdroprobot
diff --git a/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt b/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt
index 532fffd4d6..2f31e12bbf 100644
--- a/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt
+++ b/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt
@@ -1,15 +1,9 @@
# 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(simpleanchorlayout LANGUAGES CXX)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/simpleanchorlayout")
-
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_standard_project_setup()
@@ -30,7 +24,14 @@ target_link_libraries(simpleanchorlayout PRIVATE
)
install(TARGETS simpleanchorlayout
- 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 simpleanchorlayout
+ OUTPUT_SCRIPT deploy_script
+ NO_UNSUPPORTED_PLATFORM_ERROR
)
+install(SCRIPT ${deploy_script})