summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorEmmanuel Barroga <emmanuelbarroga@gmail.com>2019-09-05 22:11:03 -0700
committerEmmanuel Barroga <emmanuelbarroga@gmail.com>2019-09-05 22:17:48 -0700
commitc2b902af4b968c25cd86fb9e706edcaedb0c9dec (patch)
treed5a14febf3ea7e1b255e06805e7e911406a66f24 /scene/gui
parent4ee8ecd3efee742be58c1ff191e78d0de09b57b6 (diff)
Fixes OptionButton Not Updating if Current Selection Already Selected
When the option button's current selection is updated to a different text/icon, the selected option does not update until you unselect the option and then select it again.
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/option_button.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index d1840e43a3..de8df4215d 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -116,10 +116,16 @@ void OptionButton::add_item(const String &p_label, int p_id) {
void OptionButton::set_item_text(int p_idx, const String &p_text) {
popup->set_item_text(p_idx, p_text);
+
+ if (current == p_idx)
+ set_text(p_text);
}
void OptionButton::set_item_icon(int p_idx, const Ref<Texture> &p_icon) {
popup->set_item_icon(p_idx, p_icon);
+
+ if (current == p_idx)
+ set_icon(p_icon);
}
void OptionButton::set_item_id(int p_idx, int p_id) {