I was trying to remove all selected indices of a QTableView,
Now I use:
foreach (const QModelIndex & idx, model->selectionModel()->selectedIndexes())
{
model->removeRow (idx.row()); // Obviously bug
}
There's a obvious problem that once you remove the row, the row id is invalidated, w
As there's no function that takes directly the index (or does the index act like a iterator that will get invalidated when data changed?), I don't know what to do.
There is
QPersistanceModelIndex
class which keeps valid state of index. I tried and it seems to be working.I hope it will help.