Merge pull request #114635 from passivestar/flat-menu-button

Fix inconsistent MenuButton styles
This commit is contained in:
Rémi Verschelde 2026-01-06 11:00:27 +01:00
commit c742d107e2
No known key found for this signature in database
GPG key ID: C3336907360768E1
6 changed files with 5 additions and 35 deletions

View file

@ -199,9 +199,6 @@ void AnimationPlayerEditor::_notification(int p_what) {
pin->set_button_icon(get_editor_theme_icon(SNAME("Pin")));
tool_anim->add_theme_style_override(CoreStringName(normal), get_theme_stylebox(CoreStringName(normal), SNAME("Button")));
track_editor->get_edit_menu()->add_theme_style_override(CoreStringName(normal), get_theme_stylebox(CoreStringName(normal), SNAME("Button")));
#define ITEM_ICON(m_item, m_icon) tool_anim->get_popup()->set_item_icon(tool_anim->get_popup()->get_item_index(m_item), get_editor_theme_icon(SNAME(m_icon)))
ITEM_ICON(TOOL_NEW_ANIM, "New");

View file

@ -1375,12 +1375,6 @@ void SceneImportSettingsDialog::_notification(int p_what) {
} break;
case NOTIFICATION_THEME_CHANGED: {
action_menu->begin_bulk_theme_override();
action_menu->add_theme_style_override(CoreStringName(normal), get_theme_stylebox(CoreStringName(normal), "Button"));
action_menu->add_theme_style_override(SceneStringName(hover), get_theme_stylebox(SceneStringName(hover), "Button"));
action_menu->add_theme_style_override(SceneStringName(pressed), get_theme_stylebox(SceneStringName(pressed), "Button"));
action_menu->end_bulk_theme_override();
if (animation_player != nullptr && animation_player->is_playing()) {
animation_play_button->set_button_icon(get_editor_theme_icon(SNAME("Pause")));
} else {

View file

@ -471,6 +471,7 @@ EditorSceneTabs::EditorSceneTabs() {
scene_list = memnew(MenuButton);
scene_list->set_flat(false);
scene_list->set_theme_type_variation("FlatMenuButton");
scene_list->set_accessibility_name(TTRC("Show Opened Scenes List"));
scene_list->set_shortcut(ED_SHORTCUT("editor/show_opened_scenes_list", TTRC("Show Opened Scenes List"), KeyModifierMask::ALT | Key::T));
scene_list->get_popup()->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);

View file

@ -418,22 +418,6 @@ void ThemeClassic::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edi
p_theme->set_constant("align_to_largest_stylebox", "Button", 1); // Enabled.
// MenuButton.
p_theme->set_stylebox(CoreStringName(normal), "MenuButton", p_config.panel_container_style);
p_theme->set_stylebox(SceneStringName(hover), "MenuButton", p_config.button_style_hover);
p_theme->set_stylebox(SceneStringName(pressed), "MenuButton", p_config.panel_container_style);
p_theme->set_stylebox("focus", "MenuButton", p_config.panel_container_style);
p_theme->set_stylebox("disabled", "MenuButton", p_config.panel_container_style);
p_theme->set_color(SceneStringName(font_color), "MenuButton", p_config.font_color);
p_theme->set_color("font_hover_color", "MenuButton", p_config.font_hover_color);
p_theme->set_color("font_hover_pressed_color", "MenuButton", p_config.font_hover_pressed_color);
p_theme->set_color("font_focus_color", "MenuButton", p_config.font_focus_color);
p_theme->set_color("font_outline_color", "MenuButton", p_config.font_outline_color);
p_theme->set_constant("outline_size", "MenuButton", 0);
// MenuBar.
p_theme->set_stylebox(CoreStringName(normal), "MenuBar", p_config.button_style);

View file

@ -488,16 +488,6 @@ void ThemeModern::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edit
p_theme->set_constant("outline_size", "Button", 0);
p_theme->set_constant("align_to_largest_stylebox", "Button", 1); // Enabled.
// MenuButton.
p_theme->set_stylebox(CoreStringName(normal), "MenuButton", p_config.base_empty_wide_style);
p_theme->set_stylebox(SceneStringName(hover), "MenuButton", p_config.flat_button_hover);
p_theme->set_stylebox(SceneStringName(pressed), "MenuButton", p_config.flat_button_pressed);
p_theme->set_stylebox("focus", "MenuButton", p_config.focus_style);
p_theme->set_stylebox("disabled", "MenuButton", p_config.base_empty_wide_style);
p_theme->set_constant("outline_size", "MenuButton", 0);
// MenuBar.
p_theme->set_stylebox(CoreStringName(normal), "MenuBar", p_config.button_style);

View file

@ -2092,6 +2092,7 @@ ColorPicker::ColorPicker() {
btn_shape = memnew(MenuButton);
btn_shape->set_flat(false);
btn_shape->set_theme_type_variation("FlatMenuButton");
sample_hbc->add_child(btn_shape);
btn_shape->set_toggle_mode(true);
btn_shape->set_tooltip_text(ETR("Select a picker shape."));
@ -2142,10 +2143,12 @@ ColorPicker::ColorPicker() {
btn_mode = memnew(MenuButton);
btn_mode->set_flat(false);
btn_mode->set_theme_type_variation("FlatMenuButton");
mode_hbc->add_child(btn_mode);
btn_mode->set_toggle_mode(true);
btn_mode->set_accessibility_name(ETR("Select a picker mode."));
btn_mode->set_tooltip_text(ETR("Select a picker mode."));
btn_mode->set_icon_alignment(HORIZONTAL_ALIGNMENT_CENTER);
btn_mode->set_focus_mode(FOCUS_ALL);
mode_popup = btn_mode->get_popup();
@ -2247,6 +2250,7 @@ ColorPicker::ColorPicker() {
menu_btn = memnew(MenuButton);
menu_btn->set_flat(false);
menu_btn->set_theme_type_variation("FlatMenuButton");
menu_btn->set_focus_mode(FOCUS_ALL);
menu_btn->set_tooltip_text(ETR("Show all options available."));
menu_btn->connect("about_to_popup", callable_mp(this, &ColorPicker::_update_menu_items));