[PyKDE] more QListView problems!?

Ricardo Javier Cardenes Medina rcardenes at debian.org
Fri Jul 5 16:34:00 BST 2002


On Fri, Jul 05, 2002 at 01:52:33PM +0200, Thierry Jouve wrote:
> 
> I don't know why we must do like this, but il works......

from http://doc.trolltech.com/3.0/qlistview.html#takeItem

  void QListView::takeItem ( QListViewItem * i ) [virtual]

   Removes item i from the list view; i must be a top-level item. The
   warnings regarding QListViewItem::takeItem() apply to this function, too.

QListViewItems may have their own child QListViewItems, so the
RightWay(TM) to do this should be:

    def deleteNode( self, item, value ):
        parent = item.parent()
        if not parent:
            self.takeItem( item )
        else:
            parent.takeItem( item )

So, if there's no parent for the item (it's a top-level item), we delete
it from the QListView. Otherwise, we take it away from the parent node.

As Phil stated, the strange behaviour (and subsequent SEGFAULT) appers to
be a bug on Troll's code.




More information about the PyQt mailing list