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.
Get the QAction for the submenu you want to delete:
QAction *menuIdontLike = subMenu->menuAction();
mainMenu->removeAction(menuIdontLike);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With