[PyKDE] slowness of QTableWidget sort ?

bastian salmela basse at kulma.org
Thu Aug 24 07:28:34 BST 2006


I have rather big list of things (9000 rows, 7 columns) that I read from 
file, and add to QTableWidget, and it seems _very_ slow..
the filling of table takes some (5-10) seconds, and when I click some of the 
headers to sort it, it takes minutes. so obviously that was not usable. 

I decided test the loading and sorting in just python lists and list.sort() 
and guess what, whole process takes 1 or 2 seconds.. 

I understand 9000 rows is a lot, and as this is a toplist, i dont necessary 
need that many, so after inital sort I now add to QTableWidget only 500 
first on the list, which makes the table usable. clicking the headers for 
sorting it according to another column, still takes a bit though, and it got 
me wondering.. 

so why is QTableWidget so slow?
what is so special in the sorting method it uses, and would there be a way 
to speed it up?
sorting 9000 entries in python lists takes less than second, and in 
QTableWidget.. well.. long! 

(my table is not a complicated one, just names and numbers) 

thanks. 

.b 





More information about the PyQt mailing list