2
Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
4
This library is free software; you can redistribute it and/or modify it
5
under the terms of the GNU Library General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or (at your
7
option) any later version.
9
This library is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12
License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to the
16
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21
#ifndef DESCENDANTENTITIESPROXYMODEL_H
22
#define DESCENDANTENTITIESPROXYMODEL_H
24
#include "abstractproxymodel.h"
25
#include "akonadi_next_export.h"
29
class DescendantEntitiesProxyModelPrivate;
31
class AKONADI_NEXT_EXPORT DescendantEntitiesProxyModel : public AbstractProxyModel
38
* Creates a new descendant entities proxy model.
40
* @param parent The parent object.
42
DescendantEntitiesProxyModel( QObject *parent = 0 );
45
* Destroys the descendant entities proxy model.
47
virtual ~DescendantEntitiesProxyModel();
50
* Sets the source @p model of the proxy.
52
virtual void setSourceModel( QAbstractItemModel *model );
55
* Sets the root index to @p index. This is the root of the proxy model.
57
* @param index The root index in the *source* model which will be shown in this model.
58
* If the index is invalid, the model is empty.
60
* \note You must set the model before setting the root index.
62
void setRootIndex( const QModelIndex &index);
65
* Set whether to show ancestor data in the model. If @p display is true, then
66
* a source model which is displayed as
69
* -> "Item 0-0" (this is row-depth)
77
* will be displayed as
81
* -> "Item 0-0 / Item 0-1"
82
* -> "Item 0-0 / Item 1-1"
83
* -> "Item 0-0 / Item 1-1 / Item 0-2"
84
* -> "Item 0-0 / Item 1-1 / Item 1-2"
88
* If @p display is false, the proxy will show
101
void setDisplayAncestorData( bool display );
104
* Whether ancestor data will be displayed.
106
bool displayAncestorData() const;
109
* Sets the ancestor @p separator used between data of ancestors.
111
void setAncestorSeparator( const QString &separator );
114
* Separator used between data of ancestors.
116
QString ancestorSeparator() const;
119
* Returns the number of descendant entries for the given model @p index.
121
int descendantCount( const QModelIndex &index ) const;
123
QModelIndex mapFromSource ( const QModelIndex & sourceIndex ) const;
124
QModelIndex mapToSource ( const QModelIndex & proxyIndex ) const;
126
virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
127
QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const;
128
virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const;
130
virtual bool hasChildren ( const QModelIndex & parent = QModelIndex() ) const;
131
virtual QModelIndex index(int, int, const QModelIndex&) const;
132
virtual QModelIndex parent(const QModelIndex&) const;
133
virtual int columnCount(const QModelIndex&) const;
136
Q_DECLARE_PRIVATE( DescendantEntitiesProxyModel )
138
DescendantEntitiesProxyModelPrivate *d_ptr;
140
Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeInserted(const QModelIndex &, int, int))
141
Q_PRIVATE_SLOT(d_func(), void sourceRowsInserted(const QModelIndex &, int, int))
142
Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeRemoved(const QModelIndex &, int, int))
143
Q_PRIVATE_SLOT(d_func(), void sourceRowsRemoved(const QModelIndex &, int, int))
144
Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))
145
Q_PRIVATE_SLOT(d_func(), void sourceRowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))
146
Q_PRIVATE_SLOT(d_func(), void sourceModelAboutToBeReset())
147
Q_PRIVATE_SLOT(d_func(), void sourceModelReset())
148
Q_PRIVATE_SLOT(d_func(), void sourceLayoutAboutToBeChanged())
149
Q_PRIVATE_SLOT(d_func(), void sourceLayoutChanged())
150
Q_PRIVATE_SLOT(d_func(), void sourceDataChanged(const QModelIndex &, const QModelIndex &))
152
// Make these private, they shouldn't be called by applications
153
// virtual bool insertRows(int , int, const QModelIndex & = QModelIndex());
154
// virtual bool insertColumns(int, int, const QModelIndex & = QModelIndex());
155
// virtual bool removeRows(int, int, const QModelIndex & = QModelIndex());
156
// virtual bool removeColumns(int, int, const QModelIndex & = QModelIndex());