From b7a8ee92beeddf765d5e6000b9f8188ca8541038 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Wed, 21 Feb 2024 16:31:46 +0100 Subject: [PATCH] Core: Mention Ctrl+Shift+K into the hide menubar messagebox This way the user can trigger the "Show Menu Bar" action when the Ctrl+Alt+M doesn't work. Task-number: QTCREATORBUG-30114 Change-Id: I4e1d14b7bf7554ce1a262c4b1d2671f8d0b81b85 Reviewed-by: Leena Miettinen Reviewed-by: --- src/plugins/coreplugin/icore.cpp | 34 ++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index ef11fd6d161..54462f30512 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -1971,14 +1971,32 @@ void ICorePrivate::registerDefaultActions() toggleMenubarAction.addToContainer(Constants::M_VIEW, Constants::G_VIEW_VIEWS); toggleMenubarAction.addOnToggled(this, [](bool visible) { if (!visible) { - const QString keys = ActionManager::command(Constants::TOGGLE_MENUBAR) - ->keySequence().toString(QKeySequence::NativeText); - CheckableMessageBox::information(Core::ICore::dialogParent(), - Tr::tr("Hide Menu Bar"), - Tr::tr("This will hide the menu bar completely. " - "You can show it again by typing %1.") - .arg(keys), - Key("ToogleMenuBarHint")); + auto keySequenceAndText = [](const Utils::Id &actionName) { + const auto command = ActionManager::command(actionName); + + const QString keySequence = command->keySequence().toString( + QKeySequence::NativeText); + const QString text = command->action()->text(); + + return QPair(keySequence, text); + }; + + auto [menuBarKeys, menuBarText] = keySequenceAndText(Constants::TOGGLE_MENUBAR); + auto [actionsFromMenuKeys, actionsFromMenuText] = keySequenceAndText( + "Locator.Actions from the menu"); + + CheckableMessageBox::information( + Core::ICore::dialogParent(), + Tr::tr("Hide Menu Bar"), + Tr::tr("This will hide the menu bar completely. " + "You can show it again by typing %1." + "

" + "Or, trigger the \"%2\" action from the \"%3\" locator filter (%4).") + .arg(menuBarKeys) + .arg(menuBarText) + .arg(actionsFromMenuText) + .arg(actionsFromMenuKeys), + Key("ToogleMenuBarHint")); } globalMenuBar()->setVisible(visible); });