Хранилища Subversion OpenInventory

Редакция

Редакция 134 | Редакция 163 | К новейшей редакции | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS

Редакция 134 Редакция 161
1
#ifndef DELEGATE_H
1
#ifndef DELEGATE_H
2
#define DELEGATE_H
2
#define DELEGATE_H
3
#include <QItemDelegate>
3
#include <QItemDelegate>
4
#include <QModelIndex>
4
#include <QModelIndex>
5
#include <QSqlQuery>
5
#include <QSqlQuery>
6
#include <QObject>
6
#include <QObject>
7
#include <QSize>
7
#include <QSize>
8
#include <QSpinBox>
8
#include <QSpinBox>
9
#include <QMap>
9
#include <QMap>
10
10
11
//! [0]
11
//! [0]
12
class SpinBoxDelegate : public QItemDelegate
12
class SpinBoxDelegate : public QItemDelegate
13
{
13
{
14
    Q_OBJECT
14
    Q_OBJECT
15
15
16
public:
16
public:
17
    SpinBoxDelegate(QObject *parent = 0);
17
    SpinBoxDelegate(QObject *parent = 0);
18
18
19
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
19
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
20
                          const QModelIndex &index) const;
20
                          const QModelIndex &index) const;
21
21
22
    void setEditorData(QWidget *editor, const QModelIndex &index) const;
22
    void setEditorData(QWidget *editor, const QModelIndex &index) const;
23
    void setModelData(QWidget *editor, QAbstractItemModel *model,
23
    void setModelData(QWidget *editor, QAbstractItemModel *model,
24
                      const QModelIndex &index) const;
24
                      const QModelIndex &index) const;
25
25
26
    void updateEditorGeometry(QWidget *editor,
26
    void updateEditorGeometry(QWidget *editor,
27
        const QStyleOptionViewItem &option, const QModelIndex &index) const;
27
        const QStyleOptionViewItem &option, const QModelIndex &index) const;
28
28
29
    void getItems(); // ïîëó÷àåì ñâÿçàííûé ñïèñîê
29
    void getItems(); // ïîëó÷àåì ñâÿçàííûé ñïèñîê
30
30
31
private:
31
private:
32
     QMap <QString, QString> items; // çäåñü áóäåì õðàíèòü ñâÿçàííûé ñïèñîê èìåò îáúåêòîâ è èõ èäåíòèôèêàòîðîâ ID
32
     QMap <QString, QString> items; // çäåñü áóäåì õðàíèòü ñâÿçàííûé ñïèñîê èìåò îáúåêòîâ è èõ èäåíòèôèêàòîðîâ ID
33
33
34
34
35
};
35
};
36
//! [0]
36
//! [0]
37
37
38
class MyDEDelegate : public QItemDelegate {
38
class MyDEDelegate : public QItemDelegate {
39
       Q_OBJECT
39
       Q_OBJECT
40
   public:
40
   public:
41
       MyDEDelegate(bool calpopup = true,
41
       MyDEDelegate(bool calpopup = true,
42
                    QObject *parent = 0);
42
                    QObject *parent = 0);
43
       QWidget *createEditor(
43
       QWidget *createEditor(
44
                   QWidget *parent,
44
                   QWidget *parent,
45
                   const QStyleOptionViewItem &option,
45
                   const QStyleOptionViewItem &option,
46
                   const QModelIndex &index) const;
46
                   const QModelIndex &index) const;
47
       void setEditorData(QWidget *editor,
47
       void setEditorData(QWidget *editor,
48
                          const QModelIndex &index) const;
48
                          const QModelIndex &index) const;
49
       void setModelData(QWidget *editor,
49
       void setModelData(QWidget *editor,
50
                         QAbstractItemModel *model,
50
                         QAbstractItemModel *model,
51
                         const QModelIndex &index) const;
51
                         const QModelIndex &index) const;
52
      void updateEditorGeometry(
52
      void updateEditorGeometry(
53
              QWidget *editor,
53
              QWidget *editor,
54
              const QStyleOptionViewItem &option,
54
              const QStyleOptionViewItem &option,
55
              const QModelIndex &index) const;
55
              const QModelIndex &index) const;
56
   private:
56
   private:
57
        bool m_calpopup;
57
        bool m_calpopup;
58
    };
58
    };
59
59
-
 
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
60
#endif // DELEGATE_H
76
#endif // DELEGATE_H
61
 
77