equal
deleted
inserted
replaced
|
1 #ifndef GRIDVIEW_H |
|
2 #define GRIDVIEW_H |
|
3 |
|
4 #include <QGraphicsWidget> |
|
5 #include <QGraphicsGridLayout> |
|
6 |
|
7 |
|
8 namespace GVA { |
|
9 |
|
10 class GridView : public QGraphicsWidget |
|
11 { |
|
12 public: |
|
13 explicit GridView(QGraphicsItem *parent = 0); |
|
14 ~GridView(); |
|
15 |
|
16 void addItem(QGraphicsLayoutItem *item); |
|
17 |
|
18 enum LayoutMode{ |
|
19 Normal, |
|
20 Vertical |
|
21 }; |
|
22 |
|
23 void setMode(LayoutMode mode); |
|
24 LayoutMode mode() const { return m_mode; } |
|
25 |
|
26 void setColumnRowCounts(int columns, int rows); |
|
27 int columnCount() const { return m_columnCount; } |
|
28 int rowCount() const { return m_rowCount; } |
|
29 |
|
30 void clear(); |
|
31 void rebuildLayout(); |
|
32 |
|
33 protected: |
|
34 QGraphicsGridLayout *m_gridLayout; |
|
35 LayoutMode m_mode; |
|
36 QList<QGraphicsLayoutItem *> m_items; |
|
37 int m_columnCount; |
|
38 int m_rowCount; |
|
39 }; |
|
40 |
|
41 } // namespace |
|
42 |
|
43 #endif // GRIDVIEW_H |