21 #ifndef QGROUPINGPROXYMODEL_H
22 #define QGROUPINGPROXYMODEL_H
24 #include <QAbstractProxyModel>
25 #include <qaivlib_global.h>
27 class QGroupingProxyModelGroup;
28 class QGroupingProxyModelPrivate;
100 Q_PROPERTY(
bool groupsSpanned READ groupsSpanned WRITE setGroupsSpanned)
108 Q_PROPERTY(
int modelColumn READ modelColumn WRITE setModelColumn)
122 void addGroup(const QString & text, const QVariant & value = QVariant());
127 void addGroup(const QIcon & icon, const QString & text, const QVariant & value = QVariant());
132 int columnCount(const QModelIndex & parent = QModelIndex()) const;
136 QVariant data(const QModelIndex & proxyIndex,
int role) const;
140 Qt::ItemFlags flags(const QModelIndex & index) const;
141 bool groupsSpanned() const;
145 QVariant headerData(
int section, Qt::Orientation orientation,
int role) const;
149 QModelIndex index(
int row,
int column, const QModelIndex & parent = QModelIndex()) const;
151 int findText(const QString & text) const;
156 QModelIndex mapFromSource(const QModelIndex & sourceIndex) const;
161 QModelIndex mapToSource(const QModelIndex & proxyIndex) const;
166 int modelColumn() const;
170 QModelIndex parent(const QModelIndex & child) const;
174 bool removeGroup(
int index);
185 bool restoreGroups(const QByteArray & data);
190 int rowCount(const QModelIndex & parent = QModelIndex()) const;
200 QByteArray saveGroups() const;
204 bool setData(const QModelIndex & index, const QVariant &value,
int role);
206 void setGroupSectionHeader(const QString & header);
207 void setGroupsSpanned(
bool on);
212 void setModelColumn(
int column);
216 virtual
void setSourceModel( QAbstractItemModel* sourceModel );
217 void setUngroupedItemTitle(const QString & title);
218 void setUngroupedItemTitle(const QString & title, const QIcon & icon);
219 virtual QSize span(const QModelIndex & index) const;
221 void dataChangedHandler(const QModelIndex & topLeft, const QModelIndex & bottomRight);
222 void sourceModelResetHandler();
223 void rowsAboutToBeInsertedHandler( const QModelIndex & parent,
int start,
int end );
224 void rowsInsertedHandler(const QModelIndex & parent,
int first,
int last);
228 int groupAt(
int sourceModelRow);
229 void moveRows(
int row,
int count);
230 void removeSourceModelRow(
int sourceModelRow);
232 QString m_groupSectionHeader;
233 QGroupingProxyModelGroup* m_groupUngroupedItem;
234 QGroupingProxyModelPrivate* d;
237 #endif // QGROUPINGPROXYMODEL_H
The QGroupingProxyModel class implements a grouping proxy model.
Definition: qgroupingproxymodel.h:96