QCAD
Open Source 2D CAD
RFlowLayout.h
Go to the documentation of this file.
1 #ifndef RFLOWLAYOUT_H
2 #define RFLOWLAYOUT_H
3 
4 #include "gui_global.h"
5 
6 #include <QLayout>
7 #include <QMetaType>
8 #include <QRect>
9 #include <QStyle>
10 
11 #ifndef RDEFAULT_MIN1
12 #define RDEFAULT_MIN1 -1
13 #endif
14 
22 class QCADGUI_EXPORT RFlowLayout : public QLayout {
23  Q_OBJECT
24 
25 public:
26  RFlowLayout(QWidget* parent, int margin = RDEFAULT_MIN1, int hSpacing = RDEFAULT_MIN1, int vSpacing = RDEFAULT_MIN1);
27  RFlowLayout(int margin = RDEFAULT_MIN1, int hSpacing = RDEFAULT_MIN1, int vSpacing = RDEFAULT_MIN1);
28  ~RFlowLayout();
29 
30  void setIconSize(const QSize& s);
31  void setListViewMode(bool on);
32 
33  void addItem(QLayoutItem* item);
34  int horizontalSpacing() const;
35  int verticalSpacing() const;
36  Qt::Orientations expandingDirections() const;
37  bool hasHeightForWidth() const;
38  int heightForWidth(int) const;
39  int count() const;
40  QLayoutItem* itemAt(int index) const;
41  QSize minimumSize() const;
42  void setGeometry(const QRect& rect);
43  QSize sizeHint() const;
44  QLayoutItem* takeAt(int index);
45 
46  void insertAction(int index, QAction* action);
47  int indexOf(QAction* action) const;
48 
49  void invalidate() {
50  QLayout::invalidate();
51  }
52 
56  int indexOf(QWidget* widget) const {
57  return QLayout::indexOf(widget);
58  }
59 
60 private:
61  int doLayout(const QRect& rect, bool testOnly) const;
62  int smartSpacing(QStyle::PixelMetric pm) const;
63 
64  QList<QLayoutItem*> itemList;
65  int hSpace;
66  int vSpace;
67  QSize iconSize;
69 };
70 
72 
73 #endif
#define QCADGUI_EXPORT
Definition: gui_global.h:10
QList< QLayoutItem * > itemList
Definition: RFlowLayout.h:64
bool listViewMode
Definition: RFlowLayout.h:68
Flow layout.
Definition: RFlowLayout.h:22
QSize iconSize
Definition: RFlowLayout.h:67
Q_DECLARE_METATYPE(RMath *)
#define RDEFAULT_MIN1
Definition: RFlowLayout.h:12
int hSpace
Definition: RFlowLayout.h:65
void invalidate()
Definition: RFlowLayout.h:49
int indexOf(QWidget *widget) const
Definition: RFlowLayout.h:56
int vSpace
Definition: RFlowLayout.h:66