summaryrefslogtreecommitdiffstats
path: root/examples/widgets/graphicsview/flowlayout
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/graphicsview/flowlayout')
-rw-r--r--examples/widgets/graphicsview/flowlayout/.prev_CMakeLists.txt41
-rw-r--r--examples/widgets/graphicsview/flowlayout/CMakeLists.txt41
-rw-r--r--examples/widgets/graphicsview/flowlayout/flowlayout.cpp217
-rw-r--r--examples/widgets/graphicsview/flowlayout/flowlayout.h86
-rw-r--r--examples/widgets/graphicsview/flowlayout/flowlayout.pro10
-rw-r--r--examples/widgets/graphicsview/flowlayout/main.cpp71
-rw-r--r--examples/widgets/graphicsview/flowlayout/window.cpp71
-rw-r--r--examples/widgets/graphicsview/flowlayout/window.h58
8 files changed, 0 insertions, 595 deletions
diff --git a/examples/widgets/graphicsview/flowlayout/.prev_CMakeLists.txt b/examples/widgets/graphicsview/flowlayout/.prev_CMakeLists.txt
deleted file mode 100644
index 4208ba303e..0000000000
--- a/examples/widgets/graphicsview/flowlayout/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# Generated from flowlayout.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(flowlayout LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/flowlayout")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(flowlayout
- flowlayout.cpp flowlayout.h
- main.cpp
- window.cpp window.h
-)
-set_target_properties(flowlayout PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(flowlayout PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS flowlayout
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/graphicsview/flowlayout/CMakeLists.txt b/examples/widgets/graphicsview/flowlayout/CMakeLists.txt
deleted file mode 100644
index 9c44ec575d..0000000000
--- a/examples/widgets/graphicsview/flowlayout/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# Generated from flowlayout.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(flowlayout LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview_flowlayout") # special case
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(graphicsview_flowlayout # special case: renamed flowlayout
- flowlayout.cpp flowlayout.h
- main.cpp
- window.cpp window.h
-)
-set_target_properties(graphicsview_flowlayout PROPERTIES # special case
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(graphicsview_flowlayout PUBLIC # special case
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS graphicsview_flowlayout # special case: renamed 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 03cf320568..0000000000
--- a/examples/widgets/graphicsview/flowlayout/flowlayout.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#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 : qAsConst(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 : qAsConst(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 : qAsConst(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 14251072ec..0000000000
--- a/examples/widgets/graphicsview/flowlayout/flowlayout.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#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);
-}
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 dbfed51bb3..0000000000
--- a/examples/widgets/graphicsview/flowlayout/main.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-//! [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 d0dee2081c..0000000000
--- a/examples/widgets/graphicsview/flowlayout/window.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#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 24a7cf908b..0000000000
--- a/examples/widgets/graphicsview/flowlayout/window.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QGraphicsWidget>
-
-class Window : public QGraphicsWidget
-{
- Q_OBJECT
-public:
- Window(QGraphicsItem *parent = nullptr);
-};