[PyKDE] qactions not destroyed after qmenu menu closes

Andreas Pakulat apaku at gmx.de
Wed Nov 15 09:30:17 GMT 2006


On 14.11.06 13:42:29, Matt Chambers wrote:
> I'm dynamically creating a context menu for a QTableView, populated with some 
> QActions.  Everytime
> I right click, the menu is created.  Over time, hundreds of these closed menus 
> will set in memory, along
> with all the qactions, assoctated icons and text, ect.  When I close the app, I 
> see all of them destroyed.
> 
> Is there a way to have a qmenu clean up after itself after it closes?

Sure, remove all references to it and the python garbage collector will
delete it. This means that you shouldn't set the menu as a member of
your QTableView subclass but only create it inside the context-menu
function as a local instance.

Andreas

-- 
You possess a mind not merely twisted, but actually sprained.




More information about the PyQt mailing list