-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimeline_model.h
38 lines (28 loc) · 901 Bytes
/
timeline_model.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
#ifndef TIMELINE_MODEL_H
#define TIMELINE_MODEL_H
#include <QAbstractListModel>
#include <QList>
#include "segment.h"
class TimelineModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit TimelineModel(QObject *parent = nullptr);
enum Role {
IdRole = Qt::UserRole + 1,
NameRole,
StartAddressRole,
SizeRole
};
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
void addSegments(const QList<Segment> &segments);
void clearSegments(void);
Q_INVOKABLE QVariant ids() const;
protected:
QHash<int, QByteArray> roleNames() const override;
private:
QList<Segment> m_data;
};
#endif // TIMELINE_MODEL_H