Хранилища Subversion OpenInventory

Редакция

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

Редакция 161 Редакция 163
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
#include "iconform.h"
10
11
11
//! [0]
12
//! [0]
12
class SpinBoxDelegate : public QItemDelegate
13
class SpinBoxDelegate : public QItemDelegate
13
{
14
{
14
    Q_OBJECT
15
    Q_OBJECT
15
16
16
public:
17
public:
17
    SpinBoxDelegate(QObject *parent = 0);
18
    SpinBoxDelegate(QObject *parent = 0);
18
19
19
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
20
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
20
                          const QModelIndex &index) const;
21
                          const QModelIndex &index) const;
21
22
22
    void setEditorData(QWidget *editor, const QModelIndex &index) const;
23
    void setEditorData(QWidget *editor, const QModelIndex &index) const;
23
    void setModelData(QWidget *editor, QAbstractItemModel *model,
24
    void setModelData(QWidget *editor, QAbstractItemModel *model,
24
                      const QModelIndex &index) const;
25
                      const QModelIndex &index) const;
25
26
26
    void updateEditorGeometry(QWidget *editor,
27
    void updateEditorGeometry(QWidget *editor,
27
        const QStyleOptionViewItem &option, const QModelIndex &index) const;
28
        const QStyleOptionViewItem &option, const QModelIndex &index) const;
28
29
29
    void getItems(); // ïîëó÷àåì ñâÿçàííûé ñïèñîê
30
    void getItems(); // ïîëó÷àåì ñâÿçàííûé ñïèñîê
30
31
31
private:
32
private:
32
     QMap <QString, QString> items; // çäåñü áóäåì õðàíèòü ñâÿçàííûé ñïèñîê èìåò îáúåêòîâ è èõ èäåíòèôèêàòîðîâ ID
33
     QMap <QString, QString> items; // çäåñü áóäåì õðàíèòü ñâÿçàííûé ñïèñîê èìåò îáúåêòîâ è èõ èäåíòèôèêàòîðîâ ID
33
34
34
35
35
};
36
};
36
//! [0]
37
//! [0]
37
38
38
class MyDEDelegate : public QItemDelegate {
39
class MyDEDelegate : public QItemDelegate {
39
       Q_OBJECT
40
       Q_OBJECT
40
   public:
41
   public:
41
       MyDEDelegate(bool calpopup = true,
42
       MyDEDelegate(bool calpopup = true,
42
                    QObject *parent = 0);
43
                    QObject *parent = 0);
43
       QWidget *createEditor(
44
       QWidget *createEditor(
44
                   QWidget *parent,
45
                   QWidget *parent,
45
                   const QStyleOptionViewItem &option,
46
                   const QStyleOptionViewItem &option,
46
                   const QModelIndex &index) const;
47
                   const QModelIndex &index) const;
47
       void setEditorData(QWidget *editor,
48
       void setEditorData(QWidget *editor,
48
                          const QModelIndex &index) const;
49
                          const QModelIndex &index) const;
49
       void setModelData(QWidget *editor,
50
       void setModelData(QWidget *editor,
50
                         QAbstractItemModel *model,
51
                         QAbstractItemModel *model,
51
                         const QModelIndex &index) const;
52
                         const QModelIndex &index) const;
52
      void updateEditorGeometry(
53
      void updateEditorGeometry(
53
              QWidget *editor,
54
              QWidget *editor,
54
              const QStyleOptionViewItem &option,
55
              const QStyleOptionViewItem &option,
55
              const QModelIndex &index) const;
56
              const QModelIndex &index) const;
56
   private:
57
   private:
57
        bool m_calpopup;
58
        bool m_calpopup;
58
    };
59
    };
59
60
60
61
61
class CPictureDelegate : public QItemDelegate
62
class CPictureDelegate : public QItemDelegate
62
{
63
{
63
    mutable QPixmap m_pxPicture;
64
    mutable QPixmap m_pxPicture;
64
 public:
65
 public:
65
         CPictureDelegate( QObject *parent );
66
         CPictureDelegate( QObject *parent );
66
67
67
         void paint(QPainter *painter, const QStyleOptionViewItem &option,
68
         void paint(QPainter *painter, const QStyleOptionViewItem &option,
68
                                const QModelIndex &index) const;
69
                                const QModelIndex &index) const;
69
70
70
         //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
71
         //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
71
};
72
};
72
73
73
74
74
75
75
76
76
#endif // DELEGATE_H
77
#endif // DELEGATE_H
77
 
78