Files
seer/SeerDirectoryFilterProxyModel.h
T
2021-09-01 13:58:59 -05:00

23 lines
596 B
C++

#pragma once
#include <QtWidgets/QFileSystemModel>
#include <QtCore/QSortFilterProxyModel>
#include <QtCore/QDebug>
class SeerDirectoryFilterProxyModel : public QSortFilterProxyModel {
bool filterAcceptsRow (int sourceRow, const QModelIndex& sourceParent) const {
QFileSystemModel* fileModel = qobject_cast<QFileSystemModel*>(sourceModel());
QFileInfo file(fileModel->filePath(sourceModel()->index(sourceRow, 0, sourceParent)));
if (file.isDir() == true || file.isHidden()) {
return true;
}else{
return false;
}
}
};