From 0ce408e2a168b661783b4e8ec21a1475ac0555a4 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 10 Mar 2022 19:58:38 +0200 Subject: [PATCH 26/26] Qt: Make "Options" submenu to not disappear on MacOS Reported by ddeanbrown See osdn #43944 Signed-off-by: Marko Lindqvist --- client/gui-qt/menu.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/gui-qt/menu.cpp b/client/gui-qt/menu.cpp index e08df118e8..129811c1ff 100644 --- a/client/gui-qt/menu.cpp +++ b/client/gui-qt/menu.cpp @@ -985,7 +985,18 @@ void mr_menu::setup_menus() /* Game Menu */ menu = this->addMenu(_("Game")); pr = menu; + +#ifdef __APPLE__ + // On Mac, Qt would try to move menu entry named just "Options" to + // application menu, but as this is submenu and not an action + // 1) It would fail to appear in the destination + // 2) It's impossible to override the behavior with QAction::menuRule() + // We add an invisible character for the string comparison to fail. + menu = menu->addMenu(QString("\u200B") + _("Options")); +#else // __APPLE__ menu = menu->addMenu(_("Options")); +#endif // __APPLE__ + act = menu->addAction(_("Set local options")); connect(act, &QAction::triggered, this, &mr_menu::local_options); act = menu->addAction(_("Server Options")); -- 2.34.1