forked from AlloyTeam/Rythem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rytablemodel.h
56 lines (44 loc) · 1.47 KB
/
rytablemodel.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
#ifndef RYTABLEMODEL_H
#define RYTABLEMODEL_H
#include <QAbstractTableModel>
#include <QVector>
#include <QMap>
#include <QSharedPointer>
#include "proxy/rypipedata.h"
#include <QtCore>
class RyTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
enum Role{
RowDataRole = Qt::UserRole + 1
};
explicit RyTableModel(QObject *parent = 0);
~RyTableModel();
QMap<int,RyPipeData_ptr > pipesMap;
QVector<RyPipeData_ptr > pipesVector;
int rowCount( const QModelIndex & parent ) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
bool itemLessThan(RyPipeData_ptr left,int leftColumn,RyPipeData_ptr right,int rightColumn);
bool itemLessThan(const QModelIndex& left,const QModelIndex& right);
public slots:
void addItem(RyPipeData_ptr p);
void removeItems();
//void removeItemAtIndex();
void removeAllItem();
RyPipeData_ptr getItem(int column);
void updateItem(RyPipeData_ptr p);
signals:
//signals emit when connections are added/updated/removed
void connectionAdded(RyPipeData_ptr p);
void connectionUpdated(RyPipeData_ptr p);
void connectionRemoved(RyPipeData_ptr p);
public slots:
private:
int _pipeNumber;
int _sortingColumn;
};
#endif // RYTABLEMODEL_H