CItemDelegate.h
Go to the documentation of this file.
1 #ifndef iwidgets_CItemDelegate_included
2 #define iwidgets_CItemDelegate_included
3 
4 
5 // Qt includes
6 #include <QtCore/QtGlobal>
7 #if QT_VERSION >= 0x050000
8 #include <QtWidgets/QItemDelegate>
9 #else
10 #include <QtGui/QItemDelegate>
11 #endif
12 
13 
14 // ACF includes
15 #include <iwidgets/iwidgets.h>
16 
17 
18 namespace iwidgets
19 {
20 
21 
25 class CItemDelegate: public QItemDelegate
26 {
27 public:
28  typedef QItemDelegate BaseClass;
29 
30  CItemDelegate(int itemHeight = 20, QObject* parent = NULL);
31 
35  void SetItemHeight(int itemHeight);
36 
40  int GetItemHeight() const;
41 
42  // reimplemented (QItemDelegate)
43  virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
44  virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
45 
46 private:
47  int m_itemHeight;
48 };
49 
50 
51 } // namespace iwidgets
52 
53 
54 #endif // !iwidgets_CItemDelegate_included
55 
56 
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
int GetItemHeight() const
Get the item height.
QItemDelegate BaseClass
Definition: CItemDelegate.h:28
Standard ACF item view delegator.
Definition: CItemDelegate.h:25
#define NULL
Definition: istd.h:64
void SetItemHeight(int itemHeight)
Set the item height.
CItemDelegate(int itemHeight=20, QObject *parent=NULL)

© 2007-2017 Witold Gantzke and Kirill Lepskiy