Редакция 161 | К новейшей редакции | Содержимое файла | Последнее изменение | Открыть журнал | RSS
Редакция | Автор | № строки | Строка |
---|---|---|---|
52 | pingvin | 1 | #ifndef DELEGATE_H |
2 | #define DELEGATE_H |
||
3 | #include <QItemDelegate> |
||
4 | #include <QModelIndex> |
||
5 | #include <QObject> |
||
6 | #include <QSize> |
||
7 | #include <QSpinBox> |
||
8 | |||
9 | //! [0] |
||
10 | class SpinBoxDelegate : public QItemDelegate |
||
11 | { |
||
12 | Q_OBJECT |
||
13 | |||
14 | public: |
||
15 | SpinBoxDelegate(QObject *parent = 0); |
||
16 | |||
17 | QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, |
||
18 | const QModelIndex &index) const; |
||
19 | |||
20 | void setEditorData(QWidget *editor, const QModelIndex &index) const; |
||
21 | void setModelData(QWidget *editor, QAbstractItemModel *model, |
||
22 | const QModelIndex &index) const; |
||
23 | |||
24 | void updateEditorGeometry(QWidget *editor, |
||
25 | const QStyleOptionViewItem &option, const QModelIndex &index) const; |
||
26 | }; |
||
27 | //! [0] |
||
28 | |||
29 | class MyDEDelegate : public QItemDelegate { |
||
30 | Q_OBJECT |
||
31 | public: |
||
32 | MyDEDelegate(bool calpopup = true, |
||
33 | QObject *parent = 0); |
||
34 | QWidget *createEditor( |
||
35 | QWidget *parent, |
||
36 | const QStyleOptionViewItem &option, |
||
37 | const QModelIndex &index) const; |
||
38 | void setEditorData(QWidget *editor, |
||
39 | const QModelIndex &index) const; |
||
40 | void setModelData(QWidget *editor, |
||
41 | QAbstractItemModel *model, |
||
42 | const QModelIndex &index) const; |
||
43 | void updateEditorGeometry( |
||
44 | QWidget *editor, |
||
45 | const QStyleOptionViewItem &option, |
||
46 | const QModelIndex &index) const; |
||
47 | private: |
||
48 | bool m_calpopup; |
||
49 | }; |
||
50 | |||
51 | #endif // DELEGATE_H |