summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-08-14 09:37:54 +0200
committerGitHub <noreply@github.com>2018-08-14 09:37:54 +0200
commit98da0df8946414c57586c026527070debb4abb69 (patch)
tree4728d3b9fea7932f4c6fcc18f02bb080cb22b0c7
parentac2add26a1da33e3445b89629657f087c554247a (diff)
parent868efb8184dae7904aebf6366c5de246f052dead (diff)
Merge pull request #20982 from hpvb/fix-19842
Emit pressed events after processing items
-rw-r--r--scene/gui/popup_menu.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index ab762e19ee..cdc6b868ec 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -1049,10 +1049,8 @@ void PopupMenu::activate_item(int p_item) {
ERR_FAIL_INDEX(p_item, items.size());
ERR_FAIL_COND(items[p_item].separator);
int id = items[p_item].ID >= 0 ? items[p_item].ID : p_item;
- emit_signal("id_pressed", id);
- emit_signal("index_pressed", p_item);
- //hide all parent PopupMenue's
+ //hide all parent PopupMenus
Node *next = get_parent();
PopupMenu *pop = Object::cast_to<PopupMenu>(next);
while (pop) {
@@ -1086,6 +1084,9 @@ void PopupMenu::activate_item(int p_item) {
return;
hide();
+
+ emit_signal("id_pressed", id);
+ emit_signal("index_pressed", p_item);
}
void PopupMenu::remove_item(int p_idx) {