GroupListWidget Pile   version 0.0.1
The pile attempts to provide a widget that is capable of presenting
grouplistdelegate.h
1 
10 #ifndef GUARD_GROUP_LIST_DELEGATE_H_INCLUDE
11 #define GUARD_GROUP_LIST_DELEGATE_H_INCLUDE
12 
13 #include <grouplistwidget/grouplistwidget-config.h>
14 #include <QObject>
15 #include <QAbstractItemDelegate>
16 #include <QStyledItemDelegate>
17 
18 class GroupListWidget;
19 class GroupModel;
20 
22 class GROUPLISTWIDGET_EXPORT GroupListDelegate : public QStyledItemDelegate/* QAbstractItemDelegate */ {
23  Q_OBJECT
24 public:
25 
26  enum Layout {
27  LayInvalid = -1,
28 
32  Laymax
33  };
34 
35 public:
36 
39  QObject *parent = NULL);
40 
42  virtual ~GroupListDelegate () {}
43 
45  virtual void
46  reinit (
47  GroupListWidget * lwidget,
48  GroupModel * umodel);
49 
51  QSize
52  gridCell () const {
53  return item_size_;
54  }
55 
56 protected:
57 
58  void
59  paint (
60  QPainter * painter,
61  const QStyleOptionViewItem & option,
62  const QModelIndex & index ) const;
63 
64  QSize
65  sizeHint (
66  const QStyleOptionViewItem & option,
67  const QModelIndex & index ) const;
68 
69 
70 private:
71  QSize item_size_;
72  QRect pix_pos_;
73  QRect text_pos_;
74  Layout layout_;
75  int lay_count_;
77 }; // class GroupListDelegate
78 
79 #endif // GUARD_GROUP_LIST_DELEGATE_H_INCLUDE
Allows user to customize parts of the GroupModel.
Definition: grouplistdelegate.h:22
virtual ~GroupListDelegate()
Destructor.
Definition: grouplistdelegate.h:42
A list widget that can group the items.
Definition: grouplistwidget.h:27
Definition: grouplistdelegate.h:30
Layout
Definition: grouplistdelegate.h:26
Definition: grouplistdelegate.h:29
QSize gridCell() const
Get the size of the cell.
Definition: grouplistdelegate.h:52
A model that is to be installed into a GroupListWidget.
Definition: groupmodel.h:36