-
Notifications
You must be signed in to change notification settings - Fork 2
/
qborderlayout.h
47 lines (37 loc) · 1.24 KB
/
qborderlayout.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef QBORDERLAYOUT_H
#define QBORDERLAYOUT_H
#include <QLayout>
#include <QRect>
class QBorderLayout : public QLayout
{
public:
enum Position {West, North, South, East, Center};
explicit QBorderLayout(QWidget *parent, int margin = 0, int spacing = -1);
QBorderLayout(int spacing = -1);
~QBorderLayout();
void addItem(QLayoutItem *item) Q_DECL_OVERRIDE;
void addWidget(QWidget *widget, Position position);
Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
bool hasHeightForWidth() const Q_DECL_OVERRIDE;
int count() const Q_DECL_OVERRIDE;
QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
QSize minimumSize() const Q_DECL_OVERRIDE;
void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
QSize sizeHint() const Q_DECL_OVERRIDE;
QLayoutItem *takeAt(int index) Q_DECL_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 // QBORDERLAYOUT_H