-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdisklistmodel.h
37 lines (27 loc) · 939 Bytes
/
disklistmodel.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
#ifndef DISKLISTMODEL_H
#define DISKLISTMODEL_H
#include <QAbstractListModel>
class DiskList;
class DiskListModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(DiskList *list READ list WRITE setList)
enum {
LabelRole, DescriptionRole, IconRole, PathRole
};
public:
explicit DiskListModel(QObject *parent = nullptr);
// Basic functionality:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
// Editable:
bool setData(const QModelIndex &index, const QVariant &value,
int role = Qt::EditRole) override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
virtual QHash<int, QByteArray> roleNames() const override;
DiskList *list() const;
void setList(DiskList *list);
private:
DiskList *mList;
};
#endif // FAVOURITELISTMODEL_H