Line | |
---|
1 | #ifndef FACT_CheckBoxDelegate
|
---|
2 | #define FACT_CheckBoxDelegate
|
---|
3 |
|
---|
4 | #include <QtCore/QEvent>
|
---|
5 | #include <QtGui/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 <QtGui/QStyledItemDelegate>
|
---|
21 |
|
---|
22 | class CheckBoxDelegate : public QStyledItemDelegate
|
---|
23 | {
|
---|
24 | Q_OBJECT;
|
---|
25 |
|
---|
26 | public:
|
---|
27 | CheckBoxDelegate(QObject *p=0) : QStyledItemDelegate(p)
|
---|
28 | {
|
---|
29 | }
|
---|
30 |
|
---|
31 | void paint(QPainter *painter,
|
---|
32 | const QStyleOptionViewItem &option,
|
---|
33 | const QModelIndex &index) const;
|
---|
34 |
|
---|
35 | bool editorEvent(QEvent *evt, QAbstractItemModel *model,
|
---|
36 | const QStyleOptionViewItem &option,
|
---|
37 | const QModelIndex &index);
|
---|
38 | };
|
---|
39 |
|
---|
40 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.