Subversion Repositories OpenInventory

Rev

Rev 189 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 189 Rev 202
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
    void setFilesFields(QMap <int, QString> newFilesFields){files_map = newFilesFields;}
-
 
20
19
    QMap <int, QString> pointers(){return pointers_map;}
21
    QMap <int, QString> pointers(){return pointers_map;}
-
 
22
    QMap <int, QString> filesFields (){return files_map;}
20
    void setBooleansList(QList <int> newBoolList){bolleans_list = newBoolList;}
23
    void setBooleansList(QList <int> newBoolList){bolleans_list = newBoolList;}
-
 
24
21
    void setIconIndex(int new_index){icon_index = new_index;}
25
    void setIconIndex(int new_index){icon_index = new_index;}
22
    int iconIndex(){return icon_index;}
26
    int iconIndex(){return icon_index;}
23
27
24
private:
28
private:
25
    QMap <int, QString> pointers_map; // â ýòîì ñâÿçàííîì ñïèñêå áóäåõ õðàíèòü â êà÷åñòâå êëþ÷à íîìåðÿ ñòîëáöîâ ñ óêàçàòåëÿìè
29
    QMap <int, QString> pointers_map; // â ýòîì ñâÿçàííîì ñïèñêå áóäåõ õðàíèòü â êà÷åñòâå êëþ÷à íîìåðÿ ñòîëáöîâ ñ óêàçàòåëÿìè
26
                                  // à â êà÷åñòâå çíà÷åíèé - èìåíà òàáëèö - õðàíèëèù îáúåêòîâ ðîäèòåëüñêîãî êëàññà
30
                                  // à â êà÷åñòâå çíà÷åíèé - èìåíà òàáëèö - õðàíèëèù îáúåêòîâ ðîäèòåëüñêîãî êëàññà
-
 
31
    QMap <int, QString> files_map; // â ýòîì ñâÿçàííîì ñïèñêå áóäåõ õðàíèòü â êà÷åñòâå êëþ÷à íîìåðÿ ñòîëáöîâ, õðàíÿùèõ ôàéëû
-
 
32
                                  // à â êà÷åñòâå çíà÷åíèé - èìåíà ñòîëáöîâ
27
33
28
    QList <int> bolleans_list; // ñïèñîê ïîëåé ñ òèïîì "bool"
34
    QList <int> bolleans_list; // ñïèñîê ïîëåé ñ òèïîì "bool"
-
 
35
-
 
36
29
    int icon_index; // íîìåð ñòîëáöà, â êîòîðîì õðàíÿòüñÿ èêîíêè
37
    int icon_index; // íîìåð ñòîëáöà, â êîòîðîì õðàíÿòüñÿ èêîíêè
30
38
31
signals:
39
signals:
32
40
33
public slots:
41
public slots:
34
42
35
};
43
};
36
44
37
#endif // MYMODEL_H
45
#endif // MYMODEL_H
38
 
46