qt5base-lts/examples/widgets/layouts/borderlayout/borderlayout.h
Lucie Gérard 05fc3aef53 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-16 16:37:38 +02:00

51 lines
1.3 KiB
C++

// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef BORDERLAYOUT_H
#define BORDERLAYOUT_H
#include <QLayout>
#include <QRect>
class BorderLayout : public QLayout
{
public:
enum Position { West, North, South, East, Center };
explicit BorderLayout(QWidget *parent, const QMargins &margins = QMargins(), int spacing = -1);
BorderLayout(int spacing = -1);
~BorderLayout();
void addItem(QLayoutItem *item) override;
void addWidget(QWidget *widget, Position position);
Qt::Orientations expandingDirections() const override;
bool hasHeightForWidth() const override;
int count() const override;
QLayoutItem *itemAt(int index) const override;
QSize minimumSize() const override;
void setGeometry(const QRect &rect) override;
QSize sizeHint() const override;
QLayoutItem *takeAt(int index) override;
void add(QLayoutItem *item, Position position);
private:
struct ItemWrapper
{
ItemWrapper(QLayoutItem *i, Position p) {
item = i;
position = p;
}
QLayoutItem *item;
Position position;
};
enum SizeType { MinimumSize, SizeHint };
QSize calculateSize(SizeType sizeType) const;
QList<ItemWrapper *> list;
};
#endif // BORDERLAYOUT_H