-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilesListModel.h
More file actions
executable file
·50 lines (40 loc) · 1.64 KB
/
FilesListModel.h
File metadata and controls
executable file
·50 lines (40 loc) · 1.64 KB
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
#ifndef FILESLISTMODEL_H
#define FILESLISTMODEL_H
#include <QAbstractItemModel>
#include <QException>
#include <QDebug>
#include <QDir>
class FilesListModel : public QAbstractListModel
{
Q_OBJECT
Q_ENUMS(FilesListModelRoles)
public:
QDir oCurrentPath;
QFileInfoList oFileInfoList;
public:
enum FilesListModelRoles {
FileNameRole = Qt::UserRole + 1,
IsDir
};
explicit FilesListModel(QObject *poParent = nullptr);
~FilesListModel() override;
QHash<int,QByteArray> roleNames() const override;
QVariant data(const QModelIndex &oIndex, int iRole) const override;
bool setData(const QModelIndex &oIndex, const QVariant &oValue, int iRole = Qt::EditRole) override;
QVariant headerData(int iSection, Qt::Orientation oOrientation, int iRole = Qt::DisplayRole) const override;
Qt::ItemFlags flags(const QModelIndex &oIndex) const override;
bool insertRows(int iPosition, int iRows, const QModelIndex &oParent = QModelIndex()) override;
bool removeRows(int iPosition, int iRows, const QModelIndex &oParent = QModelIndex()) override;
QModelIndex index(int iRow, int iColumn, const QModelIndex &oParent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex &oChild) const override;
int rowCount(const QModelIndex &oParent = QModelIndex()) const override;
int columnCount(const QModelIndex &oParent = QModelIndex()) const override;
bool hasChildren(const QModelIndex &oParent) const override;
public slots:
void fnOpenDir(int iIndex);
void fnSetPath(QString sPath);
QString fnGetCurrentPath();
void fnUp();
void fnUpdate();
};
#endif // FILESLISTMODEL_H