Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, August 2007
Qt 3.1 Sorting in QListView


Message 1 in thread

Hi,

Can somebody help me to sort the 'numbers' in QListview. setsorting() 
works only for string/char.

--
 [ signature omitted ] 

Message 2 in thread

Hi Beena,

> Can somebody help me to sort the 'numbers' in QListview. setsorting()
> works only for string/char.
The trick is to subclass your QListViewItem and re-implement it's compare
function to return a proper sort order for your numerical column. Insert
these subclassed items in your listview and you can sort them any way you
like.

André

-- 
 [ signature omitted ]