akonadi
KRecursiveFilterProxyModel Class Reference
Implements recursive filtering of models. More...
#include <krecursivefilterproxymodel.h>

Public Member Functions | |
KRecursiveFilterProxyModel (QObject *parent=0) | |
virtual | ~KRecursiveFilterProxyModel () |
void | setSourceModel (QAbstractItemModel *model) |
Protected Member Functions | |
virtual bool | acceptRow (int sourceRow, const QModelIndex &sourceParent) const |
Q_PRIVATE_SLOT (d_func(), void sourceDataChanged(const QModelIndex &source_top_left, const QModelIndex &source_bottom_right)) Q_PRIVATE_SLOT(d_func() | |
void | sourceRowsAboutToBeInserted (const QModelIndex &source_parent, int start, int end)) Q_PRIVATE_SLOT(d_func() |
void void void | sourceRowsAboutToBeRemoved (const QModelIndex &source_parent, int start, int end)) Q_PRIVATE_SLOT(d_func() |
void void | sourceRowsInserted (const QModelIndex &source_parent, int start, int end)) Q_PRIVATE_SLOT(d_func() |
Protected Attributes | |
KRecursiveFilterProxyModelPrivate *const | d_ptr |
Detailed Description
Implements recursive filtering of models.
QSortFilterProxyModel does not recurse when invoking a filtering stage, so that if a particular row is filtered out, its children are not even checked to see if they match the filter.
For example, given a source model:
- A - B - - C - - - D - - - - E - - - F - - G - - H - I
If a QSortFilterProxyModel is used with a filter matching A, D, G and I, the QSortFilterProxyModel will contain
- A - I
That is, even though D and E match the filter, they are not represented in the proxy model because B does not match the filter and is filtered out.
The KRecursiveFilterProxyModel checks child indexes for filter matching and ensures that all matching indexes are represented in the model.
In the above example, the KRecursiveFilterProxyModel will contain
- A - B - - C - - - D - - G - I
That is, the leaves in the model match the filter, but not necessarily the inner branches.
QSortFilterProxyModel provides the virtual method filterAcceptsRow to allow custom filter implementations. Custom filter implementations can be written for KRecuriveFilterProxyModel using the acceptRow virtual method.
Note that using this proxy model is additional overhead compared to QSortFilterProxyModel as every index in the model must be visited and queried.
- Since:
- 4.5
Definition at line 87 of file krecursivefilterproxymodel.h.
Constructor & Destructor Documentation
KRecursiveFilterProxyModel::KRecursiveFilterProxyModel | ( | QObject * | parent = 0 |
) |
Constructor.
Definition at line 267 of file krecursivefilterproxymodel.cpp.
KRecursiveFilterProxyModel::~KRecursiveFilterProxyModel | ( | ) | [virtual] |
Destructor.
Definition at line 273 of file krecursivefilterproxymodel.cpp.
Member Function Documentation
bool KRecursiveFilterProxyModel::acceptRow | ( | int | sourceRow, | |
const QModelIndex & | sourceParent | |||
) | const [protected, virtual] |
Reimplement this method for custom filtering strategies.
Reimplemented in Akonadi::EntityRightsFilterModel.
Definition at line 296 of file krecursivefilterproxymodel.cpp.
void KRecursiveFilterProxyModel::setSourceModel | ( | QAbstractItemModel * | model | ) |
- Reimplemented from superclass.
Definition at line 301 of file krecursivefilterproxymodel.cpp.
The documentation for this class was generated from the following files: