Merge pull request #32003 from codecustard/fix_optionbutton_not_selecting

Fixes OptionButton Not Updating Current Selection
This commit is contained in:
Rémi Verschelde 2019-09-23 08:46:09 +02:00 committed by GitHub
commit 0782082433
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {