[Interest] Track QPersistentModelIndex over rejected rows/columns in a QSortFilterProxyModel

Johannes Schaub schaub.johannes at googlemail.com
Sat Sep 20 16:33:39 CEST 2014


Hello all, 

I have implemented a table widget similar to QTableView and now investigate 
how to put a QWidget as a cell item into the table. The design I have in 
mind stores a QPersistentModelIndex for each widget added to the table, just 
like QAbstractItemView::setIndexWidget does. 

The problem I currently have is that the persistent model index becomes 
permanently invalid once the proxy model that is connected to the view 
filters out its row/column (QSortFilterProxyModel::filterAcceptsRow). 


I would have expected that the QPersistentModelIndex becomes invalid only as 
long as the proxy model doesn't accept its row/column. Once the proxy 
model's filter accepts the row/column again, the persistent model index 
becomes valid again (i.e its internal pimpl body reflects the up to date 
location of the cell). 

How can I extend QSortFilterProxyModel to allow this extended tracking of 
the persistent index? 

Thanks in advance,
Johannes Schaub




More information about the Interest mailing list