mainwindow: keep Preferences in the Tools menu on macOS

On macOS Qt's text-heuristic menu role relocates any action whose text
starts with "Preferences" into the application menu. With the English
translation the Tools > Preferences action matched the heuristic and
disappeared from the Tools menu. Pin the action to QAction::NoRole so it
stays in the Tools menu on every platform and language.
This commit is contained in:
2026-07-16 22:31:21 +08:00
parent 2b118836a7
commit 15525528c9
+4
View File
@@ -368,6 +368,10 @@ MainMenu::MainMenu(MainWindow *parent)
tools_preferences_item_ = tools_menu_->AddItem(
"prefs", Core::instance(), &Core::DialogPreferencesShow, tr("Ctrl+,"));
// On macOS, Qt's text heuristic would relocate an English "Preferences"
// action to the application menu, making it disappear from the Tools menu.
// Pin it to this menu on all platforms.
tools_preferences_item_->setMenuRole(QAction::NoRole);
#ifndef NDEBUG
tools_magic_item_ =