-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathfilesystemmodel.h
More file actions
57 lines (42 loc) · 1.42 KB
/
filesystemmodel.h
File metadata and controls
57 lines (42 loc) · 1.42 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
51
52
53
54
55
56
57
#ifndef FILESYSTEMMODEL_H
#define FILESYSTEMMODEL_H
#include <QAbstractItemModel>
#include <QVector>
class QFileIconProvider;
class QFileInfo;
class FilesystemModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit FilesystemModel(QObject *parent = 0);
~FilesystemModel();
QModelIndex index(int row, int column, const QModelIndex &parent) const;
QModelIndex parent(const QModelIndex &child) const;
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
bool canFetchMore(const QModelIndex &parent) const;
void fetchMore(const QModelIndex &parent);
Qt::ItemFlags flags(const QModelIndex &index) const;
bool hasChildren(const QModelIndex &parent) const;
private:
enum Columns
{
RamificationColumn,
NameColumn = RamificationColumn,
ModificationDateColumn,
SizeColumn,
TypeColumn,
ColumnCount
};
struct NodeInfo;
typedef QVector<NodeInfo> NodeInfoList;
NodeInfoList _nodes;
QScopedPointer<QFileIconProvider> _metaProvider;
void fetchRootDirectory();
int findRow(const NodeInfo* nodeInfo) const;
QVariant nameData(const QFileInfo& fileInfo, int role) const;
};
#endif // FILESYSTEMMODEL_H