KDE 4.5 PyKDE API Reference
  • KDE's Python API
  • Overview
  • PyKDE Home
  • Sitemap
  • Contact Us
 

KRecursiveFilterProxyModel Class Reference

from PyKDE4.kdeui import *

Inherits: QSortFilterProxyModel → QAbstractProxyModel → QAbstractItemModel → QObject

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:

@verbatim - A - B - - C - - - D - - - - E - - - F - - G - - H - I @endverbatim

If a QSortFilterProxyModel is used with a filter matching A, D, G and I, the QSortFilterProxyModel will contain

@verbatim - A - I @endverbatim

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

@verbatim - A - B - - C - - - D - - G - I @endverbatim

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


Methods

 __init__ (self, QObject parent=0)
bool acceptRow (self, int sourceRow, QModelIndex sourceParent)
 setSourceModel (self, QAbstractItemModel model)

Method Documentation

__init__ (  self,
QObject  parent=0
)

Constructor

bool acceptRow (  self,
int  sourceRow,
QModelIndex  sourceParent
)

Reimplement this method for custom filtering strategies.

setSourceModel (  self,
QAbstractItemModel  model
)

  • Full Index

Modules

  • akonadi
  • dnssd
  • kdecore
  • kdeui
  • khtml
  • kio
  • knewstuff
  • kparts
  • kutils
  • nepomuk
  • phonon
  • plasma
  • polkitqt
  • solid
  • soprano
This documentation is maintained by Simon Edwards.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal