-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtsvmodel.h
47 lines (39 loc) · 1.18 KB
/
tsvmodel.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
/**
* author trungvv1
*
* date 24 Jul 2015
* class
*
* brief write something about your class
*
*
*/
#ifndef TSVMODEL_H
#define TSVMODEL_H
#include <vector>
#include <QAbstractTableModel>
#include <QStringList>
using namespace std;
class TsvModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit TsvModel(const QStringList &headers, QObject* parent = 0);
QVariant data(const QModelIndex &index, int role) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
bool insertRows(int row, int count, const QModelIndex &parent);
bool removeRows(int row, int count, const QModelIndex &parent);
Qt::ItemFlags flags(const QModelIndex &index) const;
void setValue(const vector<vector<double>> & values);
const vector<vector<double>>& getValue() const;
void setHeaders(const QStringList & headers);
void clear();
private:
int mNumRows, mNumColumns;
vector<vector<double>> mValues;
QStringList mHeaders;
};
#endif // TSVMODEL_H