Re implement columnCount, rowCount, and data functions of your inherited qidentityproxyModel...
int MyIdentityProxyModel::columnCount(...) const {
return sourceModel()->rowCount();
}
int MyIdentityProxyModel::rowCount(...) const {
return sourceModel()->columnCount();
}
{
if (role != Qt::DisplayRole) return QIdentityProxyModel::data(idx, role);
QModelIndex srcIdx
= sourceModel
()->index
(idx.
column(), idx.
role());
return srcIdx.data();
}
int MyIdentityProxyModel::columnCount(...) const {
return sourceModel()->rowCount();
}
int MyIdentityProxyModel::rowCount(...) const {
return sourceModel()->columnCount();
}
QVariant MyIdentityProxyModel::data(const QModelIndex &idx, int role)
{
if (role != Qt::DisplayRole) return QIdentityProxyModel::data(idx, role);
QModelIndex srcIdx = sourceModel()->index(idx.column(), idx.role());
return srcIdx.data();
}
To copy to clipboard, switch view to plain text mode
This is not tested code. But just to give you an idea.
Bookmarks