Хранилища Subversion OpenInventory

Редакция

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

Редакция 158 Редакция 180
1
1
#ifndef DELEGATE_H
2
2
#define DELEGATE_H
3
3
4
4
#include <QItemDelegate>
5
5
#include <QModelIndex>
6
6
#include <QObject>
7
7
#include <QSize>
8
8
#include <QSpinBox>
9
9
#include <QSqlQuery>
10
10
#include <QtSql>
11
11
#include <QtGui>
12
12
#include <QSqlDatabase>
13
13
#include <QMessageBox>
-
 
14
-
 
15
#include "iconform.h"
-
 
16
14
17
//#include <QMainWindow>
15
18
//! [0]
16
19
class SpinBoxDelegate : public QItemDelegate
17
20
{
18
21
    Q_OBJECT
19
22
20
23
public:
21
24
    SpinBoxDelegate(QObject *parent = 0);
22
25
23
26
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
24
27
                          const QModelIndex &index) const;
25
28
26
29
    void setEditorData(QWidget *editor, const QModelIndex &index) const;
27
30
    void setModelData(QWidget *editor, QAbstractItemModel *model,
28
31
                      const QModelIndex &index) const;
29
32
30
33
    void updateEditorGeometry(QWidget *editor,
31
34
        const QStyleOptionViewItem &option, const QModelIndex &index) const;
32
35
33
36
34
37
35
38
    void setInctance(QString newInctance);
36
39
    void getItems(); // ïîëó÷àåì ñâÿçàííûé ñïèñîê
37
40
38
41
39
42
40
43
41
44
private:
42
45
43
46
44
47
    QString inctance; // òàáëèöà-õðàíèëèùå, îòêóäà áóäåì áðàòü ñïèñîê
45
48
    QMap <QString, QString> items; // çäåñü áóäåì õðàíèòü ñâÿçàííûé ñïèñîê èìåò îáúåêòîâ è èõ èäåíòèôèêàòîðîâ ID
46
49
47
50
48
51
49
52
50
53
51
54
52
55
53
56
};
54
57
//! [0]
55
58
56
59
class MyDEDelegate : public QItemDelegate {
57
60
       Q_OBJECT
58
61
   public:
59
62
       MyDEDelegate(bool calpopup = true,
60
63
                    QObject *parent = 0);
61
64
       QWidget *createEditor(
62
65
                   QWidget *parent,
63
66
                   const QStyleOptionViewItem &option,
64
67
                   const QModelIndex &index) const;
65
68
       void setEditorData(QWidget *editor,
66
69
                          const QModelIndex &index) const;
67
70
       void setModelData(QWidget *editor,
68
71
                         QAbstractItemModel *model,
69
72
                         const QModelIndex &index) const;
70
73
      void updateEditorGeometry(
71
74
              QWidget *editor,
72
75
              const QStyleOptionViewItem &option,
73
76
              const QModelIndex &index) const;
74
77
   private:
75
78
        bool m_calpopup;
76
79
    };
77
80
78
81
79
82
class CPictureDelegate : public QItemDelegate
80
83
{
81
84
    mutable QPixmap m_pxPicture;
82
85
 public:
83
86
         CPictureDelegate( QObject *parent );
84
87
85
88
         void paint(QPainter *painter, const QStyleOptionViewItem &option,
86
89
                                const QModelIndex &index) const;
87
90
88
91
         //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
89
92
};
90
93
91
94
-
 
95
class IconDelegate : public QItemDelegate
-
 
96
{
-
 
97
    mutable QPixmap m_pxPicture;
-
 
98
private:
-
 
99
        QTableView *tblView;
-
 
100
-
 
101
public:
-
 
102
         IconDelegate ( QObject *parent );
-
 
103
-
 
104
         QWidget *createEditor(
-
 
105
                     QWidget *parent,
-
 
106
                     const QStyleOptionViewItem &option,
-
 
107
                     const QModelIndex &index) const;
-
 
108
-
 
109
         void setEditorData(QWidget *editor,
-
 
110
                            const QModelIndex &index) const;
-
 
111
-
 
112
         void setModelData(QWidget *editor,
-
 
113
                           QAbstractItemModel *model,
-
 
114
                           const QModelIndex &index) const;
-
 
115
-
 
116
-
 
117
         void updateEditorGeometry(
-
 
118
                 QWidget *editor,
-
 
119
                 const QStyleOptionViewItem &option,
-
 
120
                 const QModelIndex &index) const;
-
 
121
-
 
122
         void paint(QPainter *painter, const QStyleOptionViewItem &option,
-
 
123
                                const QModelIndex &index) const;
-
 
124
-
 
125
        void setTableView(QTableView* table);
-
 
126
-
 
127
-
 
128
         //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
-
 
129
};
92
130
-
 
131
-
 
132
-
 
133
class TimeEditDelegate : public QItemDelegate
-
 
134
 {
-
 
135
     Q_OBJECT
-
 
136
-
 
137
 public:
-
 
138
     TimeEditDelegate(const QString timeFormat = "dd.MM.yyyy hh:mm:ss",QObject *parent = 0) : QItemDelegate(parent) {this->timeformat = timeFormat;};
-
 
139
     void paint(QPainter *painter, const QStyleOptionViewItem &option,
-
 
140
               const QModelIndex &index) const;
-
 
141
-
 
142
 private:
-
 
143
     QString timeformat;
-
 
144
 };
-
 
145
-
 
146
-
 
147
#endif // DELEGATE_H
-
 
148