mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 13:43:49 +02:00
fix bug in Menu.removeMenu() for trees of menus
This commit is contained in:
parent
c623d8e9ac
commit
778209ffe4
2 changed files with 6 additions and 2 deletions
|
@ -32,6 +32,7 @@ function setupMenus() {
|
|||
Menu.addSeparator("Foo","Removable Tools");
|
||||
Menu.addMenuItem("Foo","Remove Foo item 4");
|
||||
Menu.addMenuItem("Foo","Remove Foo");
|
||||
Menu.addMenuItem("Foo","Remove Bar-Spam");
|
||||
Menu.addMenu("Bar");
|
||||
|
||||
Menu.addMenuItem("Bar","Bar item 1", "b");
|
||||
|
@ -91,6 +92,10 @@ function menuItemEvent(menuItem) {
|
|||
if (menuItem == "Remove Foo") {
|
||||
Menu.removeMenu("Foo");
|
||||
}
|
||||
if (menuItem == "Remove Bar-Spam") {
|
||||
Menu.removeMenu("Bar > Spam");
|
||||
}
|
||||
|
||||
if (menuItem == "Remove Spam item 2") {
|
||||
Menu.removeMenuItem("Bar > Spam", "Spam item 2");
|
||||
}
|
||||
|
|
|
@ -1414,9 +1414,8 @@ void Menu::removeMenu(const QString& menuName) {
|
|||
if (action) {
|
||||
QString finalMenuPart;
|
||||
QMenu* parent = getMenuParent(menuName, finalMenuPart);
|
||||
|
||||
if (parent) {
|
||||
removeAction(parent, finalMenuPart);
|
||||
parent->removeAction(action);
|
||||
} else {
|
||||
QMenuBar::removeAction(action);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue