253
|
1 #ifndef __gui__layouts__flow_layout_h
|
|
2 #define __gui__layouts__flow_layout_h
|
|
3
|
|
4 #include <QLayout>
|
|
5 #include <QRect>
|
|
6 #include <QStyle>
|
|
7
|
|
8 class QWidget;
|
|
9 class QLayoutItem;
|
|
10
|
|
11 class FlowLayout : public QLayout {
|
|
12 public:
|
|
13 explicit FlowLayout(QWidget* parent, int margin = -1, int hSpacing = -1, int vSpacing = -1);
|
|
14 explicit FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1);
|
|
15 ~FlowLayout();
|
|
16
|
|
17 void addItem(QLayoutItem* item) override;
|
|
18 int horizontalSpacing() const;
|
|
19 int verticalSpacing() const;
|
|
20 Qt::Orientations expandingDirections() const override;
|
|
21 bool hasHeightForWidth() const override;
|
|
22 int heightForWidth(int) const override;
|
|
23 int count() const override;
|
|
24 QLayoutItem* itemAt(int index) const override;
|
|
25 QSize minimumSize() const override;
|
|
26 void setGeometry(const QRect& rect) override;
|
|
27 QSize sizeHint() const override;
|
|
28 QLayoutItem* takeAt(int index) override;
|
|
29
|
|
30 private:
|
|
31 int doLayout(const QRect& rect, bool testOnly) const;
|
|
32 int smartSpacing(QStyle::PixelMetric pm) const;
|
|
33
|
|
34 QList<QLayoutItem*> item_list;
|
|
35 int _horiz_space;
|
|
36 int _vert_space;
|
|
37 };
|
|
38
|
|
39 #endif // __gui__layouts__flow_layout_h |