14 #ifndef ROOTINDEXPROXY_H
15 #define ROOTINDEXPROXY_H
16 #include <modelutilities_global.h>
17 #include <QIdentityProxyModel>
18 class RootIndexProxyModelPrivate;
22 Q_PROPERTY(QModelIndex rootIndex READ rootIndex WRITE setRootIndex NOTIFY rootIndexChanged)
28 QModelIndex rootIndex()
const;
29 void setRootIndex(
const QModelIndex &root);
30 QModelIndex mapToSource(
const QModelIndex &proxyIndex)
const override;
31 QModelIndex mapFromSource(
const QModelIndex &sourceIndex)
const override;
32 void setSourceModel(QAbstractItemModel *sourceModel)
override;
33 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const override;
34 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
35 int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
36 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent)
override;
37 bool insertRows(
int row,
int count,
const QModelIndex &parent = QModelIndex())
override;
38 bool insertColumns(
int column,
int count,
const QModelIndex &parent = QModelIndex())
override;
39 bool removeColumns(
int column,
int count,
const QModelIndex &parent = QModelIndex())
override;
40 bool removeRows(
int row,
int count,
const QModelIndex &parent = QModelIndex())
override;
41 bool hasChildren(
const QModelIndex &parent)
const override;
42 bool canFetchMore(
const QModelIndex &parent)
const override;
43 void fetchMore(
const QModelIndex &parent)
override;
44 bool moveColumns(
const QModelIndex &sourceParent,
int sourceColumn,
int count,
const QModelIndex &destinationParent,
45 int destinationChild)
override;
46 bool moveRows(
const QModelIndex &sourceParent,
int sourceRow,
int count,
const QModelIndex &destinationParent,
int destinationChild)
override;
48 void rootIndexChanged();
52 RootIndexProxyModelPrivate *m_dptr;
This proxy model will display only the portion of a tree model with the common ancestor rootIndex.
Definition: rootindexproxymodel.h:20