You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 19:11:41 +00:00
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.
This commit is contained in:
@@ -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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user