I have a QTableWidget
with first column populated with checkable items, so I needed to overload those items to be able to sort them. Sorting works as expected when I click on header of that column (rows are sorted - first there are checked rows and then not checked).
The problem occurs when I run my GUI and do not click on header of any column to sort table and then do this:
tableWidget.setSortingEnabled(0);
// check/uncheck some checkable items here
tableWidget.setSortingEnabled(1);
In that situation overridden __lt__
is called 100+ times, but I do not expect that because I didn't clicked on header of that column to sort. So, why __lt__
is called? Why it compares some checkable items even if I didn't clicked on header of that column to sort them?
Please help me, calling __lt__
consumes too much time when I have 30+ rows.