Logo    
KDWinUtils
Helper library for MFC to Qt migration
Loading...
Searching...
No Matches
KSortFilterProxyModel Class Reference

The KSortFilterProxyModel is a QSortFilterProxyModel that allows custom sorting. More...

#include <ksortfilterproxymodel.h>

Inheritance diagram for KSortFilterProxyModel:
[legend]
Collaboration diagram for KSortFilterProxyModel:
[legend]

Public Types

using SortFunction = std::function<bool(const QModelIndex &, const QModelIndex &)>
 

Public Member Functions

 KSortFilterProxyModel (QObject *parent=nullptr)
 
void setSortFunction (SortFunction fn)
 

Protected Member Functions

bool lessThan (const QModelIndex &left, const QModelIndex &right) const override
 

Detailed Description

The KSortFilterProxyModel is a QSortFilterProxyModel that allows custom sorting.

This class allows to set a custom sorting function that will be used to sort the items in the model. The default implementation of lessThan() will call the custom sorting function if it is set, otherwise it will call the base class implementation.

This class is used internally by KListModel but can also be used as is in new code.

Member Typedef Documentation

◆ SortFunction

using KSortFilterProxyModel::SortFunction = std::function<bool(const QModelIndex &, const QModelIndex &)>

Constructor & Destructor Documentation

◆ KSortFilterProxyModel()

KSortFilterProxyModel::KSortFilterProxyModel ( QObject * parent = nullptr)

Member Function Documentation

◆ lessThan()

bool KSortFilterProxyModel::lessThan ( const QModelIndex & left,
const QModelIndex & right ) const
overrideprotected

Calls the custom sort function if it is set, otherwise calls the base class implementation.

◆ setSortFunction()

void KSortFilterProxyModel::setSortFunction ( SortFunction fn)

Sets the sort function.


The documentation for this class was generated from the following file: