Subversion Repositories OpenInventory

Rev

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

Rev 158 Rev 187
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;}
-
 
22
    int IconIndex(){return icon_index;}
21
23
22
private:
24
private:
23
    QMap <int, QString> pointers_map; // â ýòîì ñâÿçàííîì ñïèñêå áóäåõ õðàíèòü â êà÷åñòâå êëþ÷à íîìåðÿ ñòîëáöîâ ñ óêàçàòåëÿìè
25
    QMap <int, QString> pointers_map; // â ýòîì ñâÿçàííîì ñïèñêå áóäåõ õðàíèòü â êà÷åñòâå êëþ÷à íîìåðÿ ñòîëáöîâ ñ óêàçàòåëÿìè
24
                                  // à â êà÷åñòâå çíà÷åíèé - èìåíà òàáëèö - õðàíèëèù îáúåêòîâ ðîäèòåëüñêîãî êëàññà
26
                                  // à â êà÷åñòâå çíà÷åíèé - èìåíà òàáëèö - õðàíèëèù îáúåêòîâ ðîäèòåëüñêîãî êëàññà
25
27
26
    QList <int> bolleans_list; // ñïèñîê ïîëåé ñ òèïîì "bool"
28
    QList <int> bolleans_list; // ñïèñîê ïîëåé ñ òèïîì "bool"
-
 
29
    int icon_index; // íîìåð ñòîëáöà, â êîòîðîì õðàíÿòüñÿ èêîíêè
27
30
28
signals:
31
signals:
29
32
30
public slots:
33
public slots:
31
34
32
};
35
};
33
36
34
#endif // MYMODEL_H
37
#endif // MYMODEL_H
35
 
38