diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 46ac8187c43..e34384dd6c6 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -46,6 +46,9 @@ void Button::_set_internal_margin(Side p_side, float p_value) { _internal_margin[p_side] = p_value; } +void Button::_queue_update_size_cache() { +} + void Button::_update_theme_item_cache() { BaseButton::_update_theme_item_cache(); @@ -544,6 +547,7 @@ Ref Button::get_icon() const { void Button::set_expand_icon(bool p_enabled) { if (expand_icon != p_enabled) { expand_icon = p_enabled; + _queue_update_size_cache(); queue_redraw(); update_minimum_size(); } diff --git a/scene/gui/button.h b/scene/gui/button.h index 733f40c84e5..792e7e24dae 100644 --- a/scene/gui/button.h +++ b/scene/gui/button.h @@ -100,6 +100,7 @@ private: protected: void _set_internal_margin(Side p_side, float p_value); virtual void _update_theme_item_cache() override; + virtual void _queue_update_size_cache(); void _notification(int p_what); static void _bind_methods(); diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 750c631faac..451ac941092 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -176,7 +176,7 @@ bool OptionButton::_set(const StringName &p_name, const Variant &p_value) { } if (property == "text" || property == "icon") { - _queue_refresh_cache(); + _queue_update_size_cache(); } return valid; @@ -243,7 +243,7 @@ void OptionButton::add_icon_item(const Ref &p_icon, const String &p_l if (first_selectable) { select(get_item_count() - 1); } - _queue_refresh_cache(); + _queue_update_size_cache(); } void OptionButton::add_item(const String &p_label, int p_id) { @@ -252,7 +252,7 @@ void OptionButton::add_item(const String &p_label, int p_id) { if (first_selectable) { select(get_item_count() - 1); } - _queue_refresh_cache(); + _queue_update_size_cache(); } void OptionButton::set_item_text(int p_idx, const String &p_text) { @@ -261,7 +261,7 @@ void OptionButton::set_item_text(int p_idx, const String &p_text) { if (current == p_idx) { set_text(p_text); } - _queue_refresh_cache(); + _queue_update_size_cache(); } void OptionButton::set_item_icon(int p_idx, const Ref &p_icon) { @@ -270,7 +270,7 @@ void OptionButton::set_item_icon(int p_idx, const Ref &p_icon) { if (current == p_idx) { set_icon(p_icon); } - _queue_refresh_cache(); + _queue_update_size_cache(); } void OptionButton::set_item_id(int p_idx, int p_id) { @@ -456,7 +456,7 @@ void OptionButton::_refresh_size_cache() { update_minimum_size(); } -void OptionButton::_queue_refresh_cache() { +void OptionButton::_queue_update_size_cache() { if (cache_refresh_pending) { return; } @@ -490,7 +490,7 @@ void OptionButton::remove_item(int p_idx) { if (current == p_idx) { _select(NONE_SELECTED); } - _queue_refresh_cache(); + _queue_update_size_cache(); } PopupMenu *OptionButton::get_popup() const { diff --git a/scene/gui/option_button.h b/scene/gui/option_button.h index b741ebeeddf..7dcb3319c62 100644 --- a/scene/gui/option_button.h +++ b/scene/gui/option_button.h @@ -66,13 +66,13 @@ class OptionButton : public Button { void _select(int p_which, bool p_emit = false); void _select_int(int p_which); void _refresh_size_cache(); - void _queue_refresh_cache(); virtual void pressed() override; protected: Size2 get_minimum_size() const override; virtual void _update_theme_item_cache() override; + virtual void _queue_update_size_cache() override; void _notification(int p_what); bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const;