-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcffflashdatablocksmodel.h
38 lines (28 loc) · 1.16 KB
/
cffflashdatablocksmodel.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 CFFFLASHDATABLOCKSMODEL_H
#define CFFFLASHDATABLOCKSMODEL_H
#include <QAbstractListModel>
#include <QObject>
#include "cffflashdatablock.h"
class CFFFlashDataBlocksModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit CFFFlashDataBlocksModel(QObject *parent = nullptr);
enum ListRoles
{
Name = Qt::UserRole+1,
FlashDataBlock
};
int rowCount(const QModelIndex &parent = QModelIndex()) const override {Q_UNUSED(parent) return this->m_objs.count();}
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QHash<int, QByteArray> roleNames() const override{return this->m_roles;}
Q_INVOKABLE void addFlashDataBlock(CFFFlashDataBlock *);
Q_INVOKABLE void addFlashDataBlocks(QList<CFFFlashDataBlock *>);
Q_INVOKABLE void removeFlashDataBlock(CFFFlashDataBlock *);
Q_INVOKABLE CFFFlashDataBlock * blockAt(qint32 index);
Q_INVOKABLE QList<CFFFlashDataBlock *> getFlashDataBlocks(){return this->m_objs;}
private:
QList<CFFFlashDataBlock *> m_objs;
QHash<int, QByteArray> m_roles;
};
#endif // CFFFLASHDATABLOCKSMODEL_H