Хранилища Subversion OpenInventory

Редакция

Редакция 201 | Редакция 224 | К новейшей редакции | Содержимое файла | Сравнить с предыдущей | Последнее изменение | Открыть журнал | RSS

Редакция Автор № строки Строка
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>
126 pingvin 9
#include <QSqlQuery>
10
#include <QtSql>
11
#include <QtGui>
12
#include <QSqlDatabase>
13
#include <QMessageBox>
180 pingvin 14
 
15
#include "iconform.h"
201 pingvin 16
#include "fileform.h"
180 pingvin 17
 
126 pingvin 18
//#include <QMainWindow>
122 pingvin 19
//! [0]
20
class SpinBoxDelegate : public QItemDelegate
21
{
22
    Q_OBJECT
23
 
24
public:
25
    SpinBoxDelegate(QObject *parent = 0);
26
 
27
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
28
                          const QModelIndex &index) const;
29
 
30
    void setEditorData(QWidget *editor, const QModelIndex &index) const;
31
    void setModelData(QWidget *editor, QAbstractItemModel *model,
32
                      const QModelIndex &index) const;
33
 
34
    void updateEditorGeometry(QWidget *editor,
35
        const QStyleOptionViewItem &option, const QModelIndex &index) const;
126 pingvin 36
 
37
 
38
 
39
    void setInctance(QString newInctance);
40
    void getItems(); //   
41
 
42
 
43
 
44
 
45
private:
46
 
47
 
48
    QString inctance; // -,    
49
    QMap <QString, QString> items; //           ID
50
 
219 pingvin 51
};
126 pingvin 52
 
53
 
54
 
55
 
56
 
219 pingvin 57
class FilterConditionDelegate : public QItemDelegate
58
{
59
    Q_OBJECT
126 pingvin 60
 
219 pingvin 61
public:
62
    FilterConditionDelegate(QObject *parent = 0);
63
 
64
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
65
                          const QModelIndex &index) const;
66
 
67
    void setEditorData(QWidget *editor, const QModelIndex &index) const;
68
    void setModelData(QWidget *editor, QAbstractItemModel *model,
69
                      const QModelIndex &index) const;
70
 
71
    void updateEditorGeometry(QWidget *editor,
72
        const QStyleOptionViewItem &option, const QModelIndex &index) const;
73
 
74
 
75
 
76
    void setClassID(QString newClassID);
77
//    void getItems(); //   
78
 
79
    void setItems(QStringList new_items){items = new_items;}
80
 
81
 
82
private:
83
 
84
 
85
    QString class_id; // -,    
86
//    QMap <QString, QString> items; //           ID
87
    QStringList items; // 
122 pingvin 88
};
219 pingvin 89
 
90
 
91
 
92
 
122 pingvin 93
//! [0]
219 pingvin 94
class FilterSpinBoxDelegate : public QItemDelegate
95
{
96
    Q_OBJECT
122 pingvin 97
 
219 pingvin 98
public:
99
    FilterSpinBoxDelegate(QObject *parent = 0);
100
 
101
    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
102
                          const QModelIndex &index) const;
103
 
104
    void setEditorData(QWidget *editor, const QModelIndex &index) const;
105
    void setModelData(QWidget *editor, QAbstractItemModel *model,
106
                      const QModelIndex &index) const;
107
 
108
    void updateEditorGeometry(QWidget *editor,
109
        const QStyleOptionViewItem &option, const QModelIndex &index) const;
110
 
111
 
112
 
113
    void setClassID(QString newClassID);
114
    void getItems(); //   
115
 
116
 
117
 
118
 
119
private:
120
 
121
 
122
    QString class_id; // -,    
123
    QMap <QString, QString> items; //           ID
124
};
125
 
126
 
127
 
128
 
129
 
130
 
131
 
132
 
133
//! [0]
134
 
122 pingvin 135
class MyDEDelegate : public QItemDelegate {
136
       Q_OBJECT
137
   public:
138
       MyDEDelegate(bool calpopup = true,
139
                    QObject *parent = 0);
140
       QWidget *createEditor(
141
                   QWidget *parent,
142
                   const QStyleOptionViewItem &option,
143
                   const QModelIndex &index) const;
144
       void setEditorData(QWidget *editor,
145
                          const QModelIndex &index) const;
146
       void setModelData(QWidget *editor,
147
                         QAbstractItemModel *model,
148
                         const QModelIndex &index) const;
149
      void updateEditorGeometry(
150
              QWidget *editor,
151
              const QStyleOptionViewItem &option,
152
              const QModelIndex &index) const;
153
   private:
154
        bool m_calpopup;
155
    };
156
 
157
 
138 pingvin 158
class CPictureDelegate : public QItemDelegate
159
{
160
    mutable QPixmap m_pxPicture;
161
 public:
162
         CPictureDelegate( QObject *parent );
122 pingvin 163
 
138 pingvin 164
         void paint(QPainter *painter, const QStyleOptionViewItem &option,
165
                                const QModelIndex &index) const;
166
 
167
         //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
168
};
169
 
170
 
180 pingvin 171
class IconDelegate : public QItemDelegate
172
{
173
    mutable QPixmap m_pxPicture;
174
private:
175
        QTableView *tblView;
138 pingvin 176
 
180 pingvin 177
public:
178
         IconDelegate ( QObject *parent );
158 pingvin 179
 
180 pingvin 180
         QWidget *createEditor(
181
                     QWidget *parent,
182
                     const QStyleOptionViewItem &option,
183
                     const QModelIndex &index) const;
158 pingvin 184
 
180 pingvin 185
         void setEditorData(QWidget *editor,
186
                            const QModelIndex &index) const;
187
 
188
         void setModelData(QWidget *editor,
189
                           QAbstractItemModel *model,
190
                           const QModelIndex &index) const;
191
 
192
 
193
         void updateEditorGeometry(
194
                 QWidget *editor,
195
                 const QStyleOptionViewItem &option,
196
                 const QModelIndex &index) const;
197
 
198
         void paint(QPainter *painter, const QStyleOptionViewItem &option,
199
                                const QModelIndex &index) const;
200
 
201
        void setTableView(QTableView* table);
202
 
203
 
204
         //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
205
};
206
 
201 pingvin 207
class FileDelegate : public QItemDelegate
208
{
209
    mutable QByteArray m_Data;
210
private:
211
        // QTableView *tblView;
180 pingvin 212
 
201 pingvin 213
public:
214
         FileDelegate ( QObject *parent );
180 pingvin 215
 
201 pingvin 216
         QWidget *createEditor(
217
                     QWidget *parent,
218
                     const QStyleOptionViewItem &option,
219
                     const QModelIndex &index) const;
220
 
221
         void setEditorData(QWidget *editor,
222
                            const QModelIndex &index) const;
223
 
224
         void setModelData(QWidget *editor,
225
                           QAbstractItemModel *model,
226
                           const QModelIndex &index) const;
227
 
228
 
229
         void updateEditorGeometry(
230
                 QWidget *editor,
231
                 const QStyleOptionViewItem &option,
232
                 const QModelIndex &index) const;
233
 
234
/*
235
         void paint(QPainter *painter, const QStyleOptionViewItem &option,
236
                                const QModelIndex &index) const;
237
*/
238
 
239
 
240
 
241
//         void setTableView(QTableView* table);
242
 
243
 
244
         //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
245
};
246
 
158 pingvin 247
class TimeEditDelegate : public QItemDelegate
248
 {
249
     Q_OBJECT
250
 
251
 public:
252
     TimeEditDelegate(const QString timeFormat = "dd.MM.yyyy hh:mm:ss",QObject *parent = 0) : QItemDelegate(parent) {this->timeformat = timeFormat;};
253
     void paint(QPainter *painter, const QStyleOptionViewItem &option,
254
               const QModelIndex &index) const;
255
 
256
 private:
257
     QString timeformat;
258
 };
259
 
260
 
122 pingvin 261
#endif // DELEGATE_H