Subversion Repositories OpenInventory

Rev

Rev 126 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
122 pingvin 1
#ifndef DELEGATE_H
2
#define DELEGATE_H
3
 
4
#include <QItemDelegate>
5
#include <QModelIndex>
6
#include <QObject>
7
#include <QSize>
8
#include <QSpinBox>
9
 
10
 
11
//! [0]
12
class SpinBoxDelegate : public QItemDelegate
13
{
14
    Q_OBJECT
15
 
16
public:
17
    SpinBoxDelegate(QObject *parent = 0);
18
 
19
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
20
                          const QModelIndex &index) const;
21
 
22
    void setEditorData(QWidget *editor, const QModelIndex &index) const;
23
    void setModelData(QWidget *editor, QAbstractItemModel *model,
24
                      const QModelIndex &index) const;
25
 
26
    void updateEditorGeometry(QWidget *editor,
27
        const QStyleOptionViewItem &option, const QModelIndex &index) const;
28
};
29
//! [0]
30
 
31
class MyDEDelegate : public QItemDelegate {
32
       Q_OBJECT
33
   public:
34
       MyDEDelegate(bool calpopup = true,
35
                    QObject *parent = 0);
36
       QWidget *createEditor(
37
                   QWidget *parent,
38
                   const QStyleOptionViewItem &option,
39
                   const QModelIndex &index) const;
40
       void setEditorData(QWidget *editor,
41
                          const QModelIndex &index) const;
42
       void setModelData(QWidget *editor,
43
                         QAbstractItemModel *model,
44
                         const QModelIndex &index) const;
45
      void updateEditorGeometry(
46
              QWidget *editor,
47
              const QStyleOptionViewItem &option,
48
              const QModelIndex &index) const;
49
   private:
50
        bool m_calpopup;
51
    };
52
 
53
 
54
 
55
#endif // DELEGATE_H