From 73d71cffdca2ec6ec6579620efbbe64b1f52d86e Mon Sep 17 00:00:00 2001 From: Michael Behrens Date: Tue, 2 Jun 2026 03:36:26 +0200 Subject: [PATCH] Display keyboard shortcuts in the map editor toolbar --- src/gui/map/map_editor.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/gui/map/map_editor.cpp b/src/gui/map/map_editor.cpp index 0725453b1..2c5e30868 100644 --- a/src/gui/map/map_editor.cpp +++ b/src/gui/map/map_editor.cpp @@ -1145,6 +1145,27 @@ void MapEditorController::createMenuAndToolbars() // Refactored so we can do custom key bindings in the future assignKeyboardShortcuts(); + // Append keyboard shortcuts in tool menu if the exist + const auto updateShortcutText = [](QAction* action) { + if (action && !action->shortcut().isEmpty()) { + auto shortcut_text = action->shortcut().toString(QKeySequence::NativeText); + action->setText(action->text() + QStringLiteral(" (") + shortcut_text + QLatin1Char(')')); + } + }; + for (auto* action : { + edit_tool_act, edit_line_tool_act, draw_point_act, draw_path_act, + draw_circle_act, draw_rectangle_act, draw_fill_act, draw_text_act, + duplicate_act, switch_symbol_act, fill_border_act, switch_dashes_act, + connect_paths_act, cut_tool_act, cut_hole_act, + rotate_act, rotate_pattern_act, scale_act, measure_act, + boolean_union_act, boolean_intersection_act, boolean_difference_act, + boolean_xor_act, boolean_merge_holes_act, + convert_to_curves_act, simplify_path_act, + clip_area_act, erase_area_act, distribute_points_act + }) { + updateShortcutText(action); + } + // Extend file menu QMenu* file_menu = window->getFileMenu(); QAction* insertion_act = window->getFileMenuExtensionAct();