[PyKDE] Hpw to delete a qiconViewItem?

Andreas Pakulat apaku at gmx.de
Mon Apr 17 17:31:21 BST 2006


On 17.04.06 18:54:36, Alvaro Arenas wrote:
> I have created a qiconview and added several qiconviewitems. Now when
> I click one I want that this icon is deleted.
> I can now which icon is with the currentItem() function, but I don't
> know how to delete it. (myCurrentItem = self.myIconView.currentItem()
> 
> I have tried:
> del myCurrentItem
> 
> but the qiconView is not updated and actually the icon is not deleted
> since I can click it again and still perform some actions.

You need to "clear" all references to the object, so you have to tell
the iconview to forget about the item (i.e. by using takeItem) and you
should not save a reference to it in a global or class/instance
variable. This way at the end of the function which performs the
"deletion" the python object gets garbage collected and thus the C++
object gets destroyed.

Andreas

-- 
Better hope the life-inspector doesn't come around while you have your
life in such a mess.




More information about the PyQt mailing list