I have a QTableView
with QSortFilterProxyModel
between the view and the model (QStandardItemModel
). The problem is when I call sort() I'm unable to restore original order of lines in a table. I was trying to acheve that by changing model proxy to QIdentityProxy
on-the-fly but to no avail, as the only change is that lines are renumbered but order is kept sorted.
Is it possible to somehow "unsort" data? I think, that code is unnecessary in this case, but will post if asked.
I'm using Qt5 on Win x64
P.S.: The same problem was posted here back in 2009 but never was answered.
To restore initial unsorted state ( tested )
sortModel->setSortRole(Qt::InitialSortOrderRole);
sortModel->invalidate();
QSortFilterProxyModel::setSortRole(int role)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With