Hi, I am looking for a bit more elaboration on the problem of deleting elements from a QListsView. I know this is a tricky problem with references, but I have not been able to extract enough knowledge from the documentation to solve a specific problem:
In a dialog I have a QListView called referenceList. Entries are added and deleted from this list with buttons addButton and removeButton connected with sockets: ---- class IdeaInputBase(QDialog): def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl) self.connect(self.addButton,SIGNAL("clicked()"),self.addNewReferenceSlot) self.connect(self.removeButton,SIGNAL("clicked()"),self.removeReferenceSlot) ... ---- class IdeaInput(IdeaInputBase): def __init__(self): IdeaInputBase.__init__(self) def addNewReferenceSlot(self): self.referenceList.insertItem(QListViewItem(self.referenceList, "An Item")) def removeReferenceSlot(self): print "selected has address %s" % (self.referenceList.selectedItem()) self.referenceList.removeChild(self.referenceList.selectedItem()) ---- Adding Items by pressing the addButton works fine. I then select one of the list elements and press the removeButton. This is the output I get. selected has address <qt.QListViewItem object at 0x1c98f0> Traceback (most recent call last): File "./idea_input.py", line 20, in removeReferenceSlot self.referenceList.removeChild(self.referenceList.selectedItem()) TypeError: argument 1 of QScrollView.removeChild() has an invalid type I see that I have an address of a QListViewItem, but I am not able to delete it. What am I obviously doing wrong here? Kind regards, -- Svenn -- http://mail.python.org/mailman/listinfo/python-list