[PyKDE] Null pointer test

Phil Thompson phil at river-bank.demon.co.uk
Thu Oct 17 23:56:00 BST 2002


On Thursday 17 October 2002 7:25 pm, Ingo Krabbe wrote:
> Hi,
>
> I've the following problem, while trying to build a tree in a QListView:
>
> Each Item of the QListView is a QListViewItem.  I insert into the tree
> in sorted manner by storing the last parent and starting with the
> QListView as the initial parent:
>
> 	item = QListViewItem( parent, X_i )
> 	parent.insertItem( item )
> 	parent = item
>
> When I want to go a level up I do:
>
> 	parent = parent.parent()
>
> But this only works if we aren't at the root node since a QListViewItem
> isn't a QObject but opens an own base class.  So
>
> 	parent.parent() would give NULL in C++.
>
> What's returned in pyqt here ?

None

Phil




More information about the PyQt mailing list