From 9b39e51e38016a0477351caa5cdf6e5e70301abd Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 16 Jul 2022 01:10:05 +0300 Subject: [PATCH 40/40] Qt: Use QMenu::clear() instead of our own implementation Remove reset_menu_and_sub_menues() See osdn #45045 Signed-off-by: Marko Lindqvist --- client/gui-qt/menu.cpp | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/client/gui-qt/menu.cpp b/client/gui-qt/menu.cpp index 5bb951cc5e..dd01193603 100644 --- a/client/gui-qt/menu.cpp +++ b/client/gui-qt/menu.cpp @@ -708,26 +708,6 @@ go_act_menu::~go_act_menu() 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. **************************************************************************/ @@ -737,7 +717,7 @@ void go_act_menu::reset() items.clear(); // Remove the menu items - reset_menu_and_sub_menues(this); + clear(); } /**********************************************************************//** -- 2.35.1