[PyKDE] Moving items in QListView up / down > How?

Phil Thompson phil at riverbankcomputing.co.uk
Mon May 30 09:38:10 BST 2005


On Monday 30 May 2005 9:10 am, Michael Zimmermann wrote:
> Hi there,
>
> just stumbled into the following problem. And try as I might I can't
> find a reason for the errors I get. Anyone willing to help?
>
> In a QListView I have a set of entries. Now I want to allow the user to
> sort (reorder) these entries.
>
> What I did was as follows:
>
> 1) In the class initialization:
> self.listview.setSorting(-1, False) 	> disable sorting
>
> 2) To move an entry:
> sel = self.listview.selectedItem()
> sel.moveItem(sel.itemAbove())
>
>
> The first one gives:
>    AttributeError setSorting
>
> #2 gives:
>    AttributeError moveItem
>
>
> If I look at the methods available for QListView and QListViewItem
> neither setSorting() nor moveItem() are shown.
>
> What is wrong here?
>
> (PyQt 3.13 installed from source; python 2.3.4; linux)

Difficult to tell without a complete script that demonstrates the problem - 
and without knowing which version of Qt.

Phil




More information about the PyQt mailing list