qtableview - selected row after add new row
Hi.
I have QTableView with QAbstractTableModel and QSortFilterProxyModel for my custom sorting.
But when i am added row before selected row, selection on table is wrong. (before update is selected row 10, i add row at position 5, and selected row is still 10, but i need 11) When i am added row after selected row, all is OK.
How can i fix it?
Re: qtableview - selected row after add new row
I reckon the issue is with the sorting. You can use the sorting QSortFilterProxyModel to map a sort index to the index of the model. See:
mapSelectionFromSource(const QItemSelection &sourceSelection) const
mapSelectionToSource(const QItemSelection &proxySelection) const