-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhistorymodel.h
54 lines (38 loc) · 1.67 KB
/
historymodel.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
#ifndef HISTORYMODEL_H
#define HISTORYMODEL_H
#include <QAbstractItemModel>
#include <QModelIndex>
#include <QVariant>
#include "grblinstruction.h"
#include "historyitem.h"
class HistoryModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit HistoryModel(QObject *parent = nullptr);
~HistoryModel();
QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
QModelIndex index(int row, int column,
const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE;
int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
void setLength(int length);
signals:
void modelUpdated(QModelIndex lastItem);
public slots:
void onBoardStartup(QString version, QList<GrblInstruction> instructionAtStartupList);
void onInstructionAcceptedInBoardCharBuffer(GrblInstruction instruction);
void onOkReceived(GrblInstruction instruction);
void onErrorReceived( GrblInstruction instruction, QString errorMessage);
void onFeedbackReceived(GrblInstruction instruction, QString feedbackMessage);
void onAlarmReceived(GrblInstruction instruction, QString alarmMessage);
private:
void addNewChild(HistoryItem *child, HistoryItem* parent);
HistoryItem* m_rootItem;
int m_maxItems;
};
#endif // HISTORYMODEL_H