mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 02:37:12 +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.addSeparator("Foo","Removable Tools");
|
||||||
Menu.addMenuItem("Foo","Remove Foo item 4");
|
Menu.addMenuItem("Foo","Remove Foo item 4");
|
||||||
Menu.addMenuItem("Foo","Remove Foo");
|
Menu.addMenuItem("Foo","Remove Foo");
|
||||||
|
Menu.addMenuItem("Foo","Remove Bar-Spam");
|
||||||
Menu.addMenu("Bar");
|
Menu.addMenu("Bar");
|
||||||
|
|
||||||
Menu.addMenuItem("Bar","Bar item 1", "b");
|
Menu.addMenuItem("Bar","Bar item 1", "b");
|
||||||
|
@ -91,6 +92,10 @@ function menuItemEvent(menuItem) {
|
||||||
if (menuItem == "Remove Foo") {
|
if (menuItem == "Remove Foo") {
|
||||||
Menu.removeMenu("Foo");
|
Menu.removeMenu("Foo");
|
||||||
}
|
}
|
||||||
|
if (menuItem == "Remove Bar-Spam") {
|
||||||
|
Menu.removeMenu("Bar > Spam");
|
||||||
|
}
|
||||||
|
|
||||||
if (menuItem == "Remove Spam item 2") {
|
if (menuItem == "Remove Spam item 2") {
|
||||||
Menu.removeMenuItem("Bar > Spam", "Spam item 2");
|
Menu.removeMenuItem("Bar > Spam", "Spam item 2");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1414,9 +1414,8 @@ void Menu::removeMenu(const QString& menuName) {
|
||||||
if (action) {
|
if (action) {
|
||||||
QString finalMenuPart;
|
QString finalMenuPart;
|
||||||
QMenu* parent = getMenuParent(menuName, finalMenuPart);
|
QMenu* parent = getMenuParent(menuName, finalMenuPart);
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
removeAction(parent, finalMenuPart);
|
parent->removeAction(action);
|
||||||
} else {
|
} else {
|
||||||
QMenuBar::removeAction(action);
|
QMenuBar::removeAction(action);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue