Subversion Repositories OpenInventory

Rev

Rev 187 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 187 Rev 189
1
#ifndef MYMODEL_H
1
#ifndef MYMODEL_H
2
#define MYMODEL_H
2
#define MYMODEL_H
3
3
4
#include <QObject>
4
#include <QObject>
5
#include <QtGui>
5
#include <QtGui>
6
#include <QSqlQueryModel>
6
#include <QSqlQueryModel>
7
#include <QSqlQuery>
7
#include <QSqlQuery>
8
#include <QSqlTableModel>
8
#include <QSqlTableModel>
9
#include <QMap>
9
#include <QMap>
10
10
11
class MyModel : public QSqlTableModel {
11
class MyModel : public QSqlTableModel {
12
Q_OBJECT
12
Q_OBJECT
13
public:
13
public:
14
    explicit MyModel(QObject *parent = 0);
14
    explicit MyModel(QObject *parent = 0);
15
    Qt::ItemFlags flags(const QModelIndex &index) const;
15
    Qt::ItemFlags flags(const QModelIndex &index) const;
16
    bool setData(const QModelIndex &, const QVariant &, int);
16
    bool setData(const QModelIndex &, const QVariant &, int);
17
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
17
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
18
    void setPointers(QMap <int, QString> newPointers){pointers_map = newPointers;}
18
    void setPointers(QMap <int, QString> newPointers){pointers_map = newPointers;}
19
    QMap <int, QString> pointers(){return pointers_map;}
19
    QMap <int, QString> pointers(){return pointers_map;}
20
    void setBooleansList(QList <int> newBoolList){bolleans_list = newBoolList;}
20
    void setBooleansList(QList <int> newBoolList){bolleans_list = newBoolList;}
21
    void setIconIndex(int new_index){icon_index = new_index;}
21
    void setIconIndex(int new_index){icon_index = new_index;}
22
    int IconIndex(){return icon_index;}
22
    int iconIndex(){return icon_index;}
23
23
24
private:
24
private:
25
    QMap <int, QString> pointers_map; // â ýòîì ñâÿçàííîì ñïèñêå áóäåõ õðàíèòü â êà÷åñòâå êëþ÷à íîìåðÿ ñòîëáöîâ ñ óêàçàòåëÿìè
25
    QMap <int, QString> pointers_map; // â ýòîì ñâÿçàííîì ñïèñêå áóäåõ õðàíèòü â êà÷åñòâå êëþ÷à íîìåðÿ ñòîëáöîâ ñ óêàçàòåëÿìè
26
                                  // à â êà÷åñòâå çíà÷åíèé - èìåíà òàáëèö - õðàíèëèù îáúåêòîâ ðîäèòåëüñêîãî êëàññà
26
                                  // à â êà÷åñòâå çíà÷åíèé - èìåíà òàáëèö - õðàíèëèù îáúåêòîâ ðîäèòåëüñêîãî êëàññà
27
27
28
    QList <int> bolleans_list; // ñïèñîê ïîëåé ñ òèïîì "bool"
28
    QList <int> bolleans_list; // ñïèñîê ïîëåé ñ òèïîì "bool"
29
    int icon_index; // íîìåð ñòîëáöà, â êîòîðîì õðàíÿòüñÿ èêîíêè
29
    int icon_index; // íîìåð ñòîëáöà, â êîòîðîì õðàíÿòüñÿ èêîíêè
30
30
31
signals:
31
signals:
32
32
33
public slots:
33
public slots:
34
34
35
};
35
};
36
36
37
#endif // MYMODEL_H
37
#endif // MYMODEL_H
38
 
38