Project

General

Profile

Bug #820 ยป 0009-Qt-Use-QMenu-clear-instead-of-our-own-implementation.patch

Marko Lindqvist, 09/05/2024 08:55 AM

View differences:

client/gui-qt/menu.cpp
instances.remove(this);
}
/**********************************************************************//**
Empty a menu of all its items and sub menues.
**************************************************************************/
static void reset_menu_and_sub_menues(QMenu *menu)
{
QAction *action;
/* Delete each existing menu item. */
foreach(action, menu->actions()) {
if (action->menu() != nullptr) {
/* Delete the sub menu */
reset_menu_and_sub_menues(action->menu());
action->menu()->deleteLater();
}
menu->removeAction(action);
action->deleteLater();
}
}
/**********************************************************************//**
Reset the goto and act menu so it will be recreated.
**************************************************************************/
void go_act_menu::reset()
{
/* Clear menu item to action ID mapping. */
// Clear menu item to action ID mapping.
items.clear();
/* Remove the menu items */
reset_menu_and_sub_menues(this);
// Remove the menu items
clear();
}
/**********************************************************************//**
    (1-1/1)