# class CollectionStatisticsDelegate

###

Module | akonadi
Namespace | Akonadi
Class | CollectionStatisticsDelegate
Inherits | QStyledItemDelegate

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:

    QTreeView *view = new QTreeView( this );

    Akonadi.CollectionStatisticsModel *model = new Akonadi.CollectionStatisticsModel( view );
    view->setModel( model );

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

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

### methods

- CollectionStatisticsDelegate (parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  parent | QTreeView |

  Creates a new collection statistics delegate.

  parent - the parent tree view, which will also take ownership

- initStyleOption (option, index)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  option | QStyleOptionViewItem |
  index | QModelIndex |

- paint (painter, option, index)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  painter | QPainter |
  option | QStyleOptionViewItem |
  index | QModelIndex |

- setUnreadCountShown (enable)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  enable | bool |

  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.

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

- unreadCountShown ( )

  returns bool

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