[PyQt] possible bug in QListWidgetItem

David Boddie dboddie at trolltech.com
Tue Mar 3 17:53:59 GMT 2009


On Tue Mar 3 17:46:15 GMT 2009, Thomas Coopman wrote:

> when I'm trying to subclass QListWidgetItem and try to set something I
> get this error: untimeError: underlying C/C++ object has been deleted
>
> some example code that triggers the bug
>
> class ItemListWidgetItem(QListWidgetItem):
>     def __init__(self, item, parent):
>         QListWidgetItem.__init__(parent)
>         self.setText("trigger bug")

You forgot to pass "self" to the base class's __init__() method:

  QListWidgetItem.__init__(self, parent)

David


More information about the PyQt mailing list