Subversion Repositories OpenInventory

Rev

Rev 134 | Rev 163 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
52 pingvin 1
#ifndef DELEGATE_H
2
#define DELEGATE_H
3
#include <QItemDelegate>
4
#include <QModelIndex>
134 pingvin 5
#include <QSqlQuery>
52 pingvin 6
#include <QObject>
7
#include <QSize>
8
#include <QSpinBox>
134 pingvin 9
#include <QMap>
52 pingvin 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;
134 pingvin 28
 
29
    void getItems(); //   
30
 
31
private:
32
     QMap <QString, QString> items; //           ID
33
 
34
 
52 pingvin 35
};
36
//! [0]
37
 
38
class MyDEDelegate : public QItemDelegate {
39
       Q_OBJECT
40
   public:
41
       MyDEDelegate(bool calpopup = true,
42
                    QObject *parent = 0);
43
       QWidget *createEditor(
44
                   QWidget *parent,
45
                   const QStyleOptionViewItem &option,
46
                   const QModelIndex &index) const;
47
       void setEditorData(QWidget *editor,
48
                          const QModelIndex &index) const;
49
       void setModelData(QWidget *editor,
50
                         QAbstractItemModel *model,
51
                         const QModelIndex &index) const;
52
      void updateEditorGeometry(
53
              QWidget *editor,
54
              const QStyleOptionViewItem &option,
55
              const QModelIndex &index) const;
56
   private:
57
        bool m_calpopup;
58
    };
59
 
161 pingvin 60
 
61
class CPictureDelegate : public QItemDelegate
62
{
63
    mutable QPixmap m_pxPicture;
64
 public:
65
         CPictureDelegate( QObject *parent );
66
 
67
         void paint(QPainter *painter, const QStyleOptionViewItem &option,
68
                                const QModelIndex &index) const;
69
 
70
         //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
71
};
72
 
73
 
74
 
75
 
52 pingvin 76
#endif // DELEGATE_H