KDE 4.7 PyKDE API Reference

- KDE's Python API

# CollectionFilterProxyModel Class Reference

`from PyKDE4.akonadi import *`

Inherits: QSortFilterProxyModel → QAbstractProxyModel → QAbstractItemModel → QObject
Namespace: Akonadi

## Detailed Description

A proxy model that filters collections by mime type.

This class can be used on top of a CollectionModel to filter out all collections that doesn't match a given mime type.

For instance, a mail application will use addMimeType( "message/rfc822" ) to only show collections containing mail.

       Akonadi.CollectionModel *model = new Akonadi.CollectionModel( this );

       Akonadi.CollectionFilterProxyModel *proxy = new Akonadi.CollectionFilterProxyModel();
       proxy->addMimeTypeFilter( "message/rfc822" );
       proxy->setSourceModel( model );

       QTreeView *view = new QTreeView( this );
       view->setModel( proxy );

Author:
  Bruno Virlet <bruno.virlet@gmail.com>

## Methods

| __init__ (self, QObject parent=0)
| addMimeTypeFilter (self, QString mimeType)
| addMimeTypeFilters (self, QStringList mimeTypes)
| clearFilters (self)
bool | filterAcceptsRow (self, int sourceRow, QModelIndex sourceParent)
Qt::ItemFlags | flags (self, QModelIndex index)
QStringList | mimeTypeFilters (self)
| setExcludeVirtualCollections (self, bool exclude)

## Method Documentation

__init__ | ( | self, |
|  | QObject | parent=0
| ) |  |  |

Creates a new collection proxy filter model.

Parameters:

  | parent | The parent object.

addMimeTypeFilter | ( | self, |
|  | QString | mimeType
| ) |  |  |

Adds a mime type to be shown by the filter.

Parameters:

  | mimeType | A mime type to be shown.

addMimeTypeFilters | ( | self, |
|  | QStringList | mimeTypes
| ) |  |  |

Adds a list of mime types to be shown by the filter.

Parameters:

  | mimeTypes | A list of mime types to be shown.

clearFilters | ( |  | self ) |

Clears all mime type filters.

bool filterAcceptsRow | ( | self, |
|  | int | sourceRow,
|  | QModelIndex | sourceParent
| ) |  |  |

Qt::ItemFlags flags | ( | self, |
|  | QModelIndex | index
| ) |  |  |

QStringList mimeTypeFilters | ( |  | self ) |

Returns the list of mime type filters.

setExcludeVirtualCollections | ( | self, |
|  | bool | exclude
| ) |  |  |

Sets whether we want virtual collections to be filtered or not. By default, virtual collections are accepted.

Parameters:

  | exclude | If true, virtual collections aren't accepted.

Since:
  4.7