-
Notifications
You must be signed in to change notification settings - Fork 2
/
drboardstreemodel.h
43 lines (32 loc) · 1.33 KB
/
drboardstreemodel.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
#ifndef DRBOARDSTREEMODEL_H
#define DRBOARDSTREEMODEL_H
#include <QObject>
#include <QAbstractItemModel>
#include <QModelIndex>
#include <QVariant>
#include "drconnection.h"
class DRBoardItem;
class DRBoardsTreeModel : public QAbstractItemModel
{
Q_OBJECT
public:
DRBoardsTreeModel(DRServerConnection *connection, QObject *parent = 0);
~DRBoardsTreeModel();
DRBoardItem * addBoard(wi_p7_message_t *message, DRBoardItem *parent = 0);
void clearBoards();
DRBoardItem * boardForPath(QString path);
DRBoardItem * boardAtIndex(const QModelIndex &index);
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
QVariant data(const QModelIndex &index, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
bool insertRows(int position, int rows, const QModelIndex &parent);
private:
DRBoardItem *rootItem;
DRBoardItem * getItem(const QModelIndex &index) const;
DRBoardItem * boardWithName(QString name, DRBoardItem *parent);
};
#endif // DRBOARDSTREEMODEL_H