27 #ifndef CUSTOMPROXYMODEL_H
28 #define CUSTOMPROXYMODEL_H
30 #include <QSortFilterProxyModel>
31 #include <QModelIndex>
33 #include <QFileSystemWatcher>
65 bool lessThan(
const QModelIndex &left,
const QModelIndex &right)
const override;
82 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent)
override;
85 Qt::DropActions supportedDropActions()
const override;
86 Qt::DropActions supportedDragActions()
const override;
87 Qt::ItemFlags flags(
const QModelIndex &index)
const override;
88 bool canDropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent)
const override;
89 bool isFilteringEnabled()
const;
100 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent)
const override;
103 void handleHiddenFileChanged(
const QString &path);
106 void loadHiddenFileNames(
const QString &hiddenFilePath);
107 void updateFiltering();
109 bool filteringEnabled;
114 QSet<QString> hiddenFileNames;
119 QFileSystemWatcher fileWatcher;
A custom proxy model for sorting items in views.
Definition: CustomProxyModel.h:45
void setSourceModel(QAbstractItemModel *sourceModel) override
Sets the source model for the proxy model to sourceModel. We override this because we read the hidden...
Definition: CustomProxyModel.cpp:47
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
Returns whether the item in the row indicated by the given source row and source parent should be inc...
Definition: CustomProxyModel.cpp:194
CustomProxyModel(QObject *parent=nullptr)
Constructs a CustomProxyModel object.
Definition: CustomProxyModel.cpp:41
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
Returns whether the item referred to by the given index is less than the item referred to by the give...
Definition: CustomProxyModel.cpp:73
void setFilteringEnabled(bool enable)
Toggles the filtering behavior on/off.
Definition: CustomProxyModel.cpp:250