Created
May 17, 2018 01:33
-
-
Save haraki/490ffba539bb36e940fc50ac5e1b82e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QSortFilterProxyModel> | |
#include <QDir> | |
class QFileSystemModel; | |
class QFileIconProvider; | |
class FolderModel : public QSortFilterProxyModel | |
{ | |
public: | |
explicit FolderModel(QObject *parent = Q_NULLPTR); | |
~FolderModel(); | |
using QSortFilterProxyModel::index; | |
QModelIndex index(const QString &path, int column = 0) const; | |
void setDotFirst(bool enable); | |
bool dotFirst(); | |
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) Q_DECL_OVERRIDE; | |
// QFileSystemModel specific API | |
QModelIndex setRootPath(const QString &path); | |
QString filePath(const QModelIndex &index) const; | |
・ | |
・ | |
・ | |
private: | |
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const Q_DECL_OVERRIDE; | |
QFileSystemModel* fsModel_; | |
bool dotFirst_; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment