QTableWidget original index sort

I use QTableWidget, and when the user clicks on a specific row, I use this index to perform some kind of operation. I also enabled sorting using setSortEnable, so when I sort it by clicking on the title, all row indices change, but I need the previous index, what should I do?

+4
source share
1 answer

I assume you need an unsorted index so that you can match this with some sort of external data list? If so, then you should use QTableView (), which will allow you to configure the sorting proxy and map indices back to the original data (models).

This question has information that may help: It is not possible to use itemFromIndex in a pressed QTreeView signal with QSortFilterProxyModel

0
source

All Articles