KDirSortFilterProxyModel Class
Acts as proxy model for KDirModel to sort and filter KFileItems. More...
Header: | #include <KDirSortFilterProxyModel> |
CMake: | find_package(KF6 REQUIRED COMPONENTS KIO) target_link_libraries(mytarget PRIVATE KF6::KIOFileWidgets) |
Public Functions
void | setSortFoldersFirst(bool foldersFirst) |
(since 5.95) void | setSortHiddenFilesLast(bool hiddenFilesLast) |
bool | sortFoldersFirst() const |
bool | sortHiddenFilesLast() const |
Qt::DropActions | supportedDragOptions() const |
Reimplemented Public Functions
virtual bool | canFetchMore(const QModelIndex &parent) const override |
virtual bool | hasChildren(const QModelIndex &parent = QModelIndex()) const override |
Static Public Members
int | pointsForPermissions(const QFileInfo &info) |
Detailed Description
A natural sorting is done. This means that items like:
- item_10.png
- item_1.png
- item_2.png
are sorted like
- item_1.png
- item_2.png
- item_10.png
Don't use it with non-KDirModel derivatives.
Member Function Documentation
[override virtual]
bool KDirSortFilterProxyModel::canFetchMore(const QModelIndex &parent) const
Returns true for 'empty' directories so they can be populated later.
[override virtual]
bool KDirSortFilterProxyModel::hasChildren(const QModelIndex &parent = QModelIndex()) const
Returns true for directories.
[static]
int KDirSortFilterProxyModel::pointsForPermissions(const QFileInfo &info)
Returns the permissions in "points". This is useful for sorting by permissions.
void KDirSortFilterProxyModel::setSortFoldersFirst(bool foldersFirst)
Choose if files and folders are sorted separately (with folders first) or not.
See also sortFoldersFirst().
[since 5.95]
void KDirSortFilterProxyModel::setSortHiddenFilesLast(bool hiddenFilesLast)
Sets a separate sorting with hidden files and folders last (true) or not (false).
This function was introduced in 5.95.
See also sortHiddenFilesLast().
bool KDirSortFilterProxyModel::sortFoldersFirst() const
Returns if files and folders are sorted separately (with folders first) or not.
See also setSortFoldersFirst().
bool KDirSortFilterProxyModel::sortHiddenFilesLast() const
See also setSortHiddenFilesLast().