• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KDEUI

Public Member Functions | Protected Member Functions | Protected Attributes

KRecursiveFilterProxyModel Class Reference

Implements recursive filtering of models. More...

#include <krecursivefilterproxymodel.h>

Inheritance diagram for KRecursiveFilterProxyModel:
Inheritance graph
[legend]

List of all members.

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.

Author:
Stephen Kelly <steveire@gmail.com>
Since:
4.5

Definition at line 87 of file krecursivefilterproxymodel.h.


Constructor & Destructor Documentation

KRecursiveFilterProxyModel::KRecursiveFilterProxyModel ( QObject *  parent = 0) [explicit]

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.

Definition at line 312 of file krecursivefilterproxymodel.cpp.

QModelIndexList KRecursiveFilterProxyModel::match ( const QModelIndex &  start,
int  role,
const QVariant &  value,
int  hits = 1,
Qt::MatchFlags  flags = Qt::MatchFlags( Qt::MatchStartsWith | Qt::MatchWrap ) 
) const [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

KRecursiveFilterProxyModelPrivate* const KRecursiveFilterProxyModel::d_ptr [protected]

Definition at line 121 of file krecursivefilterproxymodel.h.


The documentation for this class was generated from the following files:
  • krecursivefilterproxymodel.h
  • krecursivefilterproxymodel.cpp

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal