-
Notifications
You must be signed in to change notification settings - Fork 0
/
allfileslistmodel.h
49 lines (36 loc) · 1.19 KB
/
allfileslistmodel.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
#ifndef ALLFILESLISTMODEL_H
#define ALLFILESLISTMODEL_H
#include <QAbstractListModel>
#include <QJsonArray>
#include <QJsonObject>
class AllFilesListModel : public QAbstractListModel
{
Q_OBJECT
enum FILE_INFO {
FILE_NAME = 1,
FILE_SIZE,
FILE_SIZE_FORMAT,
FILE_TIME,
FILE_ICON,
FILE_DESC,
IS_FOLDER
};
public slots:
void updateDirList(const QJsonArray& fileInfo);
public:
explicit AllFilesListModel(QObject *parent = nullptr);
static AllFilesListModel* pAllFileListModel;
// Basic functionality:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QHash<int, QByteArray> roleNames() const override;
//void updateDirList(const QJsonArray& fileInfo);
Q_INVOKABLE void addSelectItem(int index, bool checked);
Q_INVOKABLE void addSelectAllItem(bool checked);
void getselectItems(QHash<int, QJsonObject>& selectItem);
void setUserName(const QString& strName);
private:
QList<QJsonObject> m_fileInfoList;
QHash<int, QJsonObject> m_selectItemList;
};
#endif // ALLFILESLISTMODEL_H