PDA

View Full Version : disable sorting on a QTableWidget



oazive
4th May 2017, 09:35
Hi everyone,
I wanted to know if there is an issue to diasble sorting on a QTableWidget, i recieve frames, process them and then put the information in a QTableWidget just like this :
12454
if someone click on a column to sort it, it becomes like this :
12455


so i want to disable sorting to avoid issues like the second image.
thank's !

Santosh Reddy
4th May 2017, 14:55
Note that if sorting is enabled (see sortingEnabled) and column is the current sort column, the row will be moved to the sorted position determined by item.
If you want to set several items of a particular row (say, by calling setItem() in a loop), you may want to turn off sorting before doing so, and turn it back on afterwards; this will allow you to use the same row argument for all items in the same row (i.e. setItem() will not move the row).
Turn off the sorting when inserting items, then enable it back.

oazive
4th May 2017, 15:43
It worked fine.
Thank you !!