Question about "delete" on QMenuBar instance..
Suppose I create a QMenuBar using "new" in c++, then I create a QMenu using "new".. I then use addMenu to add the qmenu to the qmenubar.. Then I go and "delete" the qmenubar instance.. Is the memory allocated to qmenu freed up then?
In my program did this above and then deleted the qmenubar and then when I tried to delete the qmenu instance, my program blew up.. But if I deleted the qmenu instance and then the qmenubar instance, everything worked fine..
Re: Question about "delete" on QMenuBar instance..
In Qt parent objects are deleteing their children. So if your QMenu object was a child of the QMenuBar, then deleting QMenuBar also deletes QMenu - so then you tried to delete QMenu again so the app crashed.
Re: Question about "delete" on QMenuBar instance..
Understood..
Suppose you have a qaction with its "triggered" signal attached to a slot.. The qactions parent is a qmenu, the qmenus parent is a qmenubar.. If you delete the qmenubar, does the slot-signal attachment for the qaction go away or do you need to disconnect it before you delete qaction or its parent?
Re: Question about "delete" on QMenuBar instance..
Quote:
Originally Posted by
tgreaves
Understood..
Suppose you have a qaction with its "triggered" signal attached to a slot.. The qactions parent is a qmenu, the qmenus parent is a qmenubar.. If you delete the qmenubar, does the slot-signal attachment for the qaction go away or do you need to disconnect it before you delete qaction or its parent?
You do not have to disconnect, the connection will be deleted automatically
properly.
Re: Question about "delete" on QMenuBar instance..
Awesome.. Thanks for your help guys..