Hi folks,

I have been programming Qt for a while now, but recently I started using PyQt and now I ran into a problem.

I am developing a very simple application that show lots of results from a SQL query onto a QListView. I have chosen doing this on Python since it is such a simple task, but now I want to be able to customize the sorting function used when the user clicks a column tab.

Namely I have numeric data in some columns and I need these to be properly sorted (QListView's default sorting function just performs string comparision). I have tried subclassing QListViewItem from my Python script and reimplementing the proper method ("compare( )", I guess) and it worked; numbers could be sorted as numbers in this new Widget. However sorting through this is AWFULLY SLOW for my application.

It seems clear to me that there is a performance loss caused by the fact that the compare() method (which is obviously a bottleneck for the sorting routine) is now in the script instead of the binary Qt library.

Since customized sorting for ListViews seems like such a common task for me, I am wondering whether I did something wrong, or if there is another way of doing this within PyQt.

Thanks in advance,
Fernando

_______________________________________________
PyKDE mailing list    [EMAIL PROTECTED]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to