-
Notifications
You must be signed in to change notification settings - Fork 0
/
listmodel.h
40 lines (32 loc) · 843 Bytes
/
listmodel.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
#ifndef LISTMODEL_H
#define LISTMODEL_H
#include <QAbstractListModel>
#include <QObject>
#include <quazip/quazip.h>
#include <quazip/quazipfile.h>
class ListModel : public QAbstractListModel
{
Q_OBJECT
public:
enum ImageData {
FileName = Qt::UserRole + 1,
Image,
Size
};
Q_ENUM(ImageData);
explicit ListModel(QString path, QObject *parent = nullptr);
private:
QString filePath;
QList<QModelIndex> indexes;
void loadFile(QString f);
Qt::ItemFlags flags(const QModelIndex &index) const {
return index.flags();
};
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const {
return index.data(role);
};
int rowCount(const QModelIndex &parent = QModelIndex()) const {
return indexes.count();
};
};
#endif // LISTMODEL_H