Svenn Bjerkem wrote: > 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: [...] > 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 That's because removeChild() is a QScrollView method. You can call this method because QListView inherits it from QScrollView, but it's not the method you're looking for. > 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? You need to call your QListView instance's takeItem() method with the item you want to remove as the argument. Hope this helps, David
-- http://mail.python.org/mailman/listinfo/python-list