PDA

View Full Version : deleting qaction



hyling
8th December 2006, 21:43
Hi,

Do I need to delete QAction after I add them to a QMenu?? The examples don't seem to delete them?

Will this leak memory?


QMenu menu;
menu.addAction(new Action("test", null));


Thanks
Hua-Ying

wysota
8th December 2006, 22:48
If you delete a QAction, it will be removed from the menu. But don't pass "null" as a pointer to the parent, but instead use a pointer to some QObject (like the QMenu object you create).