summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxDGameStudios <xdgamestudios@gmail.com>2019-03-11 11:29:44 +0000
committerFrancisco Dias <Dias.FranciscoA@gmail.com>2019-03-11 11:54:12 +0000
commitffc5f360e8578140b9b43d6b4f6483931ee7aaeb (patch)
treec107c6c3d29f43451fa3c553e6255af0d028340a
parent91d3ea0d1f33af26328c741835a8ff72c58d34d7 (diff)
Fixed optional idx argument in add_item (OptionMeny & PopupMenu)
-rw-r--r--scene/gui/popup_menu.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 28b124d143..94c73b2e42 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -594,7 +594,7 @@ void PopupMenu::add_item(const String &p_label, int p_ID, uint32_t p_accel) {
item.text = p_label;
item.xl_text = tr(p_label);
item.accel = p_accel;
- item.ID = p_ID;
+ item.ID = p_ID == -1 ? items.size() : p_ID;
items.push_back(item);
update();
minimum_size_changed();
@@ -632,7 +632,7 @@ void PopupMenu::add_check_item(const String &p_label, int p_ID, uint32_t p_accel
item.text = p_label;
item.xl_text = tr(p_label);
item.accel = p_accel;
- item.ID = p_ID;
+ item.ID = p_ID == -1 ? items.size() : p_ID;
item.checkable_type = Item::CHECKABLE_TYPE_CHECK_BOX;
items.push_back(item);
update();