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

KDEUI

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
KRecursiveFilterProxyModel Class Reference

#include <krecursivefilterproxymodel.h>

Inheritance diagram for KRecursiveFilterProxyModel:
Inheritance graph
[legend]

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 steve.nosp@m.ire@.nosp@m.gmail.nosp@m..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
protectedvirtual

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
This file is part of the KDE documentation.
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.

KDEUI

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal