From e84588987a4f3e0f2007d490344fa7f2452d2575 Mon Sep 17 00:00:00 2001 From: Koyper Date: Fri, 7 Jul 2023 11:48:13 -0500 Subject: [PATCH] Enabled missing Tree title button font and font size theme settings. --- doc/classes/Tree.xml | 3 +++ scene/gui/tree.cpp | 5 ++--- scene/resources/default_theme/default_theme.cpp | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml index a1932ba5b68..004e93ac046 100644 --- a/doc/classes/Tree.xml +++ b/doc/classes/Tree.xml @@ -606,6 +606,9 @@ Font size of the item's text. + + Font size of the title button's text. + The arrow icon used when a foldable item is not collapsed. diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 433ae656ba3..3c1be2d5fe6 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1922,7 +1922,7 @@ void Tree::update_column(int p_col) { columns.write[p_col].text_buf->set_direction((TextServer::Direction)columns[p_col].text_direction); } - columns.write[p_col].text_buf->add_string(columns[p_col].title, theme_cache.font, theme_cache.font_size, columns[p_col].language); + columns.write[p_col].text_buf->add_string(columns[p_col].title, theme_cache.tb_font, theme_cache.tb_font_size, columns[p_col].language); columns.write[p_col].cached_minimum_width_dirty = true; } @@ -4108,7 +4108,7 @@ void Tree::update_scrollbars() { } int Tree::_get_title_button_height() const { - ERR_FAIL_COND_V(theme_cache.font.is_null() || theme_cache.title_button.is_null(), 0); + ERR_FAIL_COND_V(theme_cache.tb_font.is_null() || theme_cache.title_button.is_null(), 0); int h = 0; if (show_column_titles) { for (int i = 0; i < columns.size(); i++) { @@ -4243,7 +4243,6 @@ void Tree::_notification(int p_what) { int ofs2 = theme_cache.panel_style->get_margin(SIDE_LEFT); for (int i = 0; i < columns.size(); i++) { Ref sb = (cache.click_type == Cache::CLICK_TITLE && cache.click_index == i) ? theme_cache.title_button_pressed : ((cache.hover_type == Cache::CLICK_TITLE && cache.hover_index == i) ? theme_cache.title_button_hover : theme_cache.title_button); - Ref f = theme_cache.tb_font; Rect2 tbrect = Rect2(ofs2 - theme_cache.offset.x, bg->get_margin(SIDE_TOP), get_column_width(i), tbh); if (cache.rtl) { tbrect.position.x = get_size().width - tbrect.size.x - tbrect.position.x; diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index d6b0fe797f2..eef46a6798e 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -762,6 +762,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_font("title_button_font", "Tree", Ref()); theme->set_font("font", "Tree", Ref()); theme->set_font_size("font_size", "Tree", -1); + theme->set_font_size("title_button_font_size", "Tree", -1); theme->set_color("title_button_color", "Tree", control_font_color); theme->set_color("font_color", "Tree", control_font_low_color);