-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcptmodel.h
47 lines (40 loc) · 1.32 KB
/
cptmodel.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 4/1/2015
* \class CptModel
*
* \brief write something about your class
*
*
*/
#ifndef CPTMODEL_H
#define CPTMODEL_H
#include <QAbstractTableModel>
#include <QStringList>
class CptModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit CptModel(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 initValues(int mNRows, int mNColumns, int mNodeparents);
void setValue(int row, int column, double value);
double getValue(int row, int column);
void setHeader(int column, QString value);
void clear();
private:
int mNRows, mNColumns;
int mNodeparents; /// number of node's parents
double **mValues; /// rows = number of assignment of parents
/// cols = nparents + nvalues
QStringList mHeaders;
};
#endif // CPTMODEL_H