KDEUI
#include <krecursivefilterproxymodel.h>
Public Member Functions | |
KRecursiveFilterProxyModel (QObject *parent=0) | |
virtual | ~KRecursiveFilterProxyModel () |
virtual QModelIndexList | match (const QModelIndex &start, int role, const QVariant &value, int hits=1, Qt::MatchFlags flags=Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const |
void | setSourceModel (QAbstractItemModel *model) |
Protected Member Functions | |
virtual bool | acceptRow (int sourceRow, const QModelIndex &sourceParent) const |
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
|
explicit |
Constructor.
Definition at line 267 of file krecursivefilterproxymodel.cpp.
|
virtual |
Destructor.
Definition at line 273 of file krecursivefilterproxymodel.cpp.
Member Function Documentation
|
protectedvirtual |
Reimplement this method for custom filtering strategies.
Definition at line 312 of file krecursivefilterproxymodel.cpp.
|
virtual |
Definition at line 296 of file krecursivefilterproxymodel.cpp.
void KRecursiveFilterProxyModel::setSourceModel | ( | QAbstractItemModel * | model | ) |
- Reimplemented from superclass.
Definition at line 317 of file krecursivefilterproxymodel.cpp.
Member Data Documentation
|
protected |
Definition at line 121 of file krecursivefilterproxymodel.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.