As I already said, QIdentityProxyModel is declared friend of QAbstractItemModel so it can call its private methods.
It depends on where you want to add the column. If at the end then the default implementation of mapFromSource() is fine and mapToSource() needs to be adjusted to return an invalid index for the artificial column.Can you give a sample implementation of mapToSouce() and mapFromSource() of the proxy (to add a column) when using QIdentityProxyModel as base class,
mapFromSource() and mapToSource() don't deal with accessing artificial columns. For that you have to reimplement index() and data().if you say one does not need to implement these, then how can QIdentityProxyModel know about the extra column and there indexes?
By the way, a problem with making a proxy derived from QAbstractItemModel and not QAbstractProxyModel (or its subclass) is that you lose the possibility of going up the chain of proxy models to reach the final model with a single loop, like so:
Qt Code:
idx = proxy->mapToSource(idx); }To copy to clipboard, switch view to plain text mode






Reply With Quote

Bookmarks