From 7b02f8f125018ebf59205899bce6d8f2edea2f81 Mon Sep 17 00:00:00 2001 From: kobewi Date: Tue, 9 Dec 2025 22:27:09 +0100 Subject: [PATCH] Add shortcuts to dock tooltips --- editor/docks/editor_dock_manager.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/editor/docks/editor_dock_manager.cpp b/editor/docks/editor_dock_manager.cpp index b67f7ccb734..a6f22eb6e07 100644 --- a/editor/docks/editor_dock_manager.cpp +++ b/editor/docks/editor_dock_manager.cpp @@ -543,25 +543,30 @@ void EditorDockManager::_update_tab_style(EditorDock *p_dock) { const TabStyle style = (tab_container == EditorNode::get_bottom_panel()) ? (TabStyle)EDITOR_GET("interface/editor/bottom_dock_tab_style").operator int() : (TabStyle)EDITOR_GET("interface/editor/dock_tab_style").operator int(); + const Ref icon = _get_dock_icon(p_dock, callable_mp((Control *)tab_container, &Control::get_editor_theme_icon)); bool assign_icon = p_dock->force_show_icon; + String tooltip; switch (style) { case TabStyle::TEXT_ONLY: { tab_container->set_tab_title(index, p_dock->get_display_title()); - tab_container->set_tab_tooltip(index, String()); } break; case TabStyle::ICON_ONLY: { tab_container->set_tab_title(index, icon.is_valid() ? String() : p_dock->get_display_title()); - tab_container->set_tab_tooltip(index, p_dock->get_display_title()); + tooltip = TTR(p_dock->get_display_title()); assign_icon = true; } break; case TabStyle::TEXT_AND_ICON: { tab_container->set_tab_title(index, p_dock->get_display_title()); - tab_container->set_tab_tooltip(index, String()); assign_icon = true; } break; } + if (p_dock->shortcut.is_valid() && p_dock->shortcut->has_valid_event()) { + tooltip += (tooltip.is_empty() ? "" : "\n") + TTR(p_dock->shortcut->get_name()) + " (" + p_dock->shortcut->get_as_text() + ")"; + } + tab_container->set_tab_tooltip(index, tooltip); + if (assign_icon) { tab_container->set_tab_icon(index, icon); } else {