: A custom QSortFilterProxyModel to do extended search. More...
#include <pqExtendedSortFilterProxyModel.h>
Inherits QSortFilterProxyModel.
Public Member Functions | |
pqExtendedSortFilterProxyModel (QObject *parent) | |
~pqExtendedSortFilterProxyModel () override=default | |
void | update () |
Triggers an update of the sort filter model. More... | |
void | setRequest (const QString &request) |
Set the user requests. More... | |
void | setRequest (int role, const QVariant &value) |
Set the user request for the given ItemRole. More... | |
void | clearRequests () |
Clear user requests. More... | |
void | setExclusion (int role, const QVariant &value) |
Set the Exclusions list. More... | |
void | clearExclusions () |
Clear the exclusion list. More... | |
Protected Member Functions | |
bool | filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override |
Returns false if row is excluded. More... | |
bool | lessThan (const QModelIndex &left, const QModelIndex &right) const override |
Sort elements depending on their priority: More... | |
: A custom QSortFilterProxyModel to do extended search.
: Allow to do extended search in a model, using different ItemRole.
Different kind of matches can be used to filter elements:
Items are sorted per match kind: exact match first, then standard match and finally user match. Within a match kind, alphabetical sort is used.
Items matching an Exlusion criteria are always hidden, regardless of the requests.
Definition at line 24 of file pqExtendedSortFilterProxyModel.h.
pqExtendedSortFilterProxyModel::pqExtendedSortFilterProxyModel | ( | QObject * | parent | ) |
|
overridedefault |
void pqExtendedSortFilterProxyModel::setRequest | ( | const QString & | request | ) |
Set the user requests.
Set the user string request for default role.
This is used for match operations. Matching items are visible (if not excluded).
filterRole is intended to be Qt::DisplayRole (default) or at least a role for QString data.
Set the user request for the given ItemRole.
Items matching this value will be shown. This acts as a "white list"
see clearUserRequests(), setExclusion()
void pqExtendedSortFilterProxyModel::clearRequests | ( | ) |
Clear user requests.
Remove custom role checks. Note that the main request is not touched.
Set the Exclusions list.
Set an exclusion rule for ItemRole.
Items matching this value will always be hidden.
see clearExclusions(), setUserRequest()
void pqExtendedSortFilterProxyModel::clearExclusions | ( | ) |
Clear the exclusion list.
void pqExtendedSortFilterProxyModel::update | ( | ) |
Triggers an update of the sort filter model.
|
overrideprotected |
Returns false if row is excluded.
Returns true if every sub part of the Request has a match. Returns false otherwise.
|
overrideprotected |
Sort elements depending on their priority:
At same priority, it uses alphanumeric comparison.