Better_Software_Header_MobileBetter_Software_Header_Web

Find what you need - explore our website and developer resources

KDFunctionalSortFilterProxyModel

A Functional Sort/Filter Proxy Model

// create the proxy
KDFunctionalSortFilterProxyModel *proxy = new KDFunctionalSortFilterProxyModel(parent);

// use this lambda as the filtering function
auto acceptFunction = [](const QAbstractItemModel *model, int source_row, const QModelIndex &parent)
{
    // decide whether to accept `source_row` from `model`, under `parent`;
    // return true to accept, false to filter the row out
};

proxy->setFilterAcceptsRowFunction(acceptFunction);

// use it!
proxy->setSourceModel(sourceModel);
view->setModel(proxy);

About KDAB


GiuseppeD'Angelo

Giuseppe D’Angelo

Senior Software Engineer

Learn Modern C++

Learn more