Хранилища Subversion OpenInventory

Редакция

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

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