Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/gui/map/map_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down