# class CollectionModel

###

Module | akonadi
Namespace | Akonadi
Class | CollectionModel
Inherits | QAbstractItemModel

A model for collections.

This class provides the interface of QAbstractItemModel for the collection tree of the Akonadi storage.

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

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

If you want to list only collections of a special mime type, use CollectionFilterProxyModel on top of this model.

Author Volker Krause <vkrause@kde.org>

### enums

- Roles { CollectionIdRole, CollectionRole, UserRole }

enum details

### methods

- CollectionModel (parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  parent | QObject | 0

  Creates a new collection model.

  parent - The parent object.

- CollectionModel (d, parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  d | CollectionModelPrivate |
  parent | QObject | 0

- collectionForId (id)

  returns Akonadi.Collection

  Argument | Type | Default
  --- | --- | ---
  id | Collection.Id |

  Returns the collection for a given collection id.

- columnCount (parent)

  returns int

  Argument | Type | Default
  --- | --- | ---
  parent | QModelIndex | QModelIndex()

- data (index, role)

  returns QVariant

  Argument | Type | Default
  --- | --- | ---
  index | QModelIndex |
  role | int | Qt.DisplayRole

- dropMimeData (data, action, row, column, parent)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  data | QMimeData |
  action | Qt.DropAction |
  row | int |
  column | int |
  parent | QModelIndex |

- fetchCollectionStatistics (enable)

  returns Nothing

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

  Sets whether collection statistics information shall be provided by the model.

  See also CollectionStatistics.

- flags (index)

  returns Qt.ItemFlags

  Argument | Type | Default
  --- | --- | ---
  index | QModelIndex |

- headerData (section, orientation, role)

  returns QVariant

  Argument | Type | Default
  --- | --- | ---
  section | int |
  orientation | Qt.Orientation |
  role | int | Qt.DisplayRole

- includeUnsubscribed (include)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  include | bool | 1

  Sets whether unsubscribed collections shall be listed in the model.

- index (row, column, parent)

  returns QModelIndex

  Argument | Type | Default
  --- | --- | ---
  row | int |
  column | int |
  parent | QModelIndex | QModelIndex()

- mimeData (indexes)

  returns QMimeData

  Argument | Type | Default
  --- | --- | ---
  indexes | QModelIndexList |

- mimeTypes ( )

  returns QStringList

- parent (index)

  returns QModelIndex

  Argument | Type | Default
  --- | --- | ---
  index | QModelIndex |

- rowCount (parent)

  returns int

  Argument | Type | Default
  --- | --- | ---
  parent | QModelIndex | QModelIndex()

- setData (index, value, role)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  index | QModelIndex |
  value | QVariant |
  role | int | Qt.EditRole

- supportedDropActions ( )

  returns Qt.DropActions

### enums - detail

- Roles { CollectionIdRole, CollectionRole, UserRole }

  Describes the roles for collections.

  | CollectionIdRole | - Qt::UserRole+1 | - |
  | CollectionRole | - | - |
  | UserRole | - Qt::UserRole+42 | - |