-
Notifications
You must be signed in to change notification settings - Fork 7
/
tablemodel.h
77 lines (61 loc) · 2.28 KB
/
tablemodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef TABLEMODEL_H
#define TABLEMODEL_H
#include <QObject>
#include <QAbstractTableModel>
#include <QVariant>
#include "ciecsignal.h"
#include <QItemSelectionModel>
#include <QStringListModel.h>
///
/// \brief Отображаемый элемент таблицы сигналов
///
/*class CTableModelItem{
public:
CTableModelItem(){
}
CTableModelItem(CIECSignal *signal){
pSignal = *signal;
*/
/*
this->SetAddress(signal->GetAddress());
this->quality = signal->quality;
this->value = signal->value;
this->timestamp = signal->timestamp;
this->SetType(signal->GetType());
this->name = name;*/
// }
/*CTableModelItem(int address, QString name= QString()){
this->SetAddress(address);
this->name = name;
}*/
/* CIECSignal pSignal;
};
*/
//таблица измерений (сигналы в направлении контроля)
class TableModel : public QAbstractTableModel
{
CIECSignal itemToAdd;
public:
//QMap<uint, CTableModelItem> *mData;
QList<CIECSignal> mData;
TableModel();
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
bool insertRows(int position, int rows, const QModelIndex &index);
bool removeRow(int row, const QModelIndex &parent=QModelIndex());
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex());
bool removeRows(QItemSelectionModel *pSelection);
//bool isSignalExist(CIECSignal*);
void updateSignal(CIECSignal, bool autoCreate = true,bool isImported=false);
//void appendSignal(CIECSignal*);
//void appendSignal(CIECSignal*, QString);
void redraw();
bool bAllowAppend; //разрешение на автоматическое добавление тэга в таблицу
Qt::ItemFlags flags(const QModelIndex &index) const;
bool setData(const QModelIndex &index, const QVariant &value,
int role = Qt::EditRole);
bool isShortTable=false; //true если надо отображать только первые три столбика
};
#endif // TABLEMODEL_H