FACT++  1.0
CheckBoxDelegate.h
Go to the documentation of this file.
1 #ifndef FACT_CheckBoxDelegate
2 #define FACT_CheckBoxDelegate
3 
4 #include <QEvent>
5 #include <QStandardItem>
6 
7 using namespace std;
8 
9 class CheckBoxEvent : public QEvent
10 {
11 public:
12  const QStandardItem &item;
13 
14  CheckBoxEvent(const QStandardItem &i)
15  : QEvent((QEvent::Type)QEvent::registerEventType()),
16  item(i) { }
17 };
18 
19 
20 #include <QStyledItemDelegate>
21 
22 class CheckBoxDelegate : public QStyledItemDelegate
23 {
24 public:
25  CheckBoxDelegate(QObject *p=0) : QStyledItemDelegate(p)
26  {
27  }
28 
29  void paint(QPainter *painter,
30  const QStyleOptionViewItem &option,
31  const QModelIndex &index) const;
32 
33  bool editorEvent(QEvent *evt, QAbstractItemModel *model,
34  const QStyleOptionViewItem &option,
35  const QModelIndex &index);
36 };
37 
38 #endif
CheckBoxDelegate(QObject *p=0)
A delegate which displays an arrow if there are sub items and raises an event if the checkbox is chec...
int i
Definition: db_dim_client.c:21
STL namespace.
CheckBoxEvent(const QStandardItem &i)
const QStandardItem & item
An event posted by the CheckBoxDelegate if the CheckBox is used.