| Line |  | 
|---|
| 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 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.