-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResultModel.hpp
37 lines (25 loc) · 1.06 KB
/
ResultModel.hpp
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
#pragma once
#include <QAbstractItemModel>
#include <QVector>
class Node;
class ResultModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit ResultModel(QObject* parent = nullptr);
~ResultModel();
QModelIndex index(int row, int column, const QModelIndex& parentIndex = QModelIndex()) const override;
QModelIndex parent(const QModelIndex& childIndex) const override;
int rowCount(const QModelIndex& parentIndex = QModelIndex()) const override;
int columnCount(const QModelIndex& parentIndex = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
void clear();
void addPath(const QString& hash, const QString& filePath);
QStringList selectedPaths() const;
void removePath(const QString& filePath);
private:
Node* _root;
};