Reputation: 101
For a QMenu, we can insert two kind of items, one is QAction, which can be removed by removeAction method, the other is another QMenu, I cannot find a way to remove the menu item from a menu.
How to do it? The only way I can think of now is to use clear() method to remove everything and re-generate the items.
Upvotes: 10
Views: 6595
Reputation: 3686
Get the QAction for the submenu you want to delete:
QAction *menuIdontLike = subMenu->menuAction();
mainMenu->removeAction(menuIdontLike);
Upvotes: 12