QTableWidget original index sorting
I am using QTableWidget and when the user clicks on a particular row, I use that index to perform some operation. I have also enabled sorting using setSortEnable, so when I sort it by clicking on a header, all row index change but I want previous index开发者_C百科 so what should I do?
I'm guessing you want the unsorted index so you can map that back to some external list of data? If that is the case, then you should use a QTableView() which will allow you to setup a sort proxy and map indexes back to your original data (model).
This question has some info that may help: Can't use itemFromIndex in clicked signal of QTreeView with QSortFilterProxyModel
精彩评论