KDE 4.7 PyKDE API Reference

- KDE's Python API

# CollectionStatisticsDelegate Class Reference

`from PyKDE4.akonadi import *`

Inherits: QStyledItemDelegate → QAbstractItemDelegate → QObject
Namespace: Akonadi

## Detailed Description

A delegate that draws unread and total count for CollectionStatisticsModel.

The delegate provides the following features:

- Collections with unread items will have the foldername and the unread column marked in bold. - If a folder is collapsed, the unread and the total column will contain the total sum of all child folders - It has the possibility to draw the unread count directly after the foldername, see toggleUnreadAfterFolderName().

Example:

     Akonadi.EntityTreeView *view = new Akonadi.EntityTreeView( this );

     Akonadi.StatisticsProxyModel *statisticsProxy = new Akonadi.StatisticsProxyModel( view );
     view->setModel( statisticsProxy );

     Akonadi.CollectionStatisticsDelegate *delegate = new Akonadi.CollectionStatisticsDelegate( view );
     view->setItemDelegate( delegate );

Note:
  This proxy model is intended to be used on top of the EntityTreeModel. One of the proxies between the EntityTreeModel (the root model) and the view must be a StatisticsProxyModel. That proxy model may appear anywhere in the chain.

Author:
  Thomas McGuire <thomas.mcguire@gmx.net>

## Methods
| __init__ (self, QTreeView parent)
| __init__ (self, QAbstractItemView parent)
| initStyleOption (self, QStyleOptionViewItem option, QModelIndex index)
| paint (self, QPainter painter, QStyleOptionViewItem option, QModelIndex index)
bool | progressAnimationEnabled (self)
| setProgressAnimationEnabled (self, bool enable)
| setUnreadCountShown (self, bool enable)
bool | unreadCountShown (self)

## Method Documentation

__init__ | ( | self, |
|  | QTreeView | parent
| ) |  |  |

Creates a new collection statistics delegate.

Parameters:

  | parent | The parent tree view, which will also take ownership.

__init__ | ( | self, |
|  | QAbstractItemView | parent
| ) |  |  |

Creates a new collection statistics delegate.

Parameters:

  | parent | The parent tree view, which will also take ownership.

initStyleOption | ( | self, |
|  | QStyleOptionViewItem | option,
|  | QModelIndex | index
| ) |  |  |

paint | ( | self, |
|  | QPainter | painter,
|  | QStyleOptionViewItem | option,
|  | QModelIndex | index
| ) |  |  |

bool progressAnimationEnabled | ( |  | self ) |

setProgressAnimationEnabled | ( | self, |
|  | bool | enable
| ) |  |  |

setUnreadCountShown | ( | self, |
|  | bool | enable
| ) |  |  |

Sets whether the unread count is drawn next to the folder name.

You probably want to enable this when the unread count is hidden only. This is disabled by default.

Parameters:

  | enable | If true, the unread count is drawn next to the folder name, if false, the folder name will be drawn normally.

bool unreadCountShown | ( |  | self ) |

Returns whether the unread count is drawn next to the folder name.