[PyKDE] The order of items in QListView

Boudewijn Rempt boud at rempt.xs4all.nl
Thu May 31 07:27:01 BST 2001


On Wednesday 30 May 2001 09:08, you wrote:
> When I use QListViewItem, I got an unexpected result.
> Here is a simple sample code. In this sample,
> the order of items which I add is 'Europe', 'Asia'.
> But I got the order of items which is 'Asia', 'Europe'.
>
>

Not really unexpected: unless you explicitly tell the listview
or listviewitem after which item the new item should be placed,
it's placed first. Its the difference between

QListViewItem ( QListView * parent ) 
QListViewItem ( QListViewItem * parent ) 

and

QListViewItem ( QListView * parent, QListViewItem * after ) 
QListViewItem ( QListViewItem * parent, QListViewItem * after ) 

If you want to always insert your item as the last item in 
a branch, you'll have to keep track of which item is the
previous last.





More information about the PyQt mailing list