Merge pull request #20982 from hpvb/fix-19842

Emit pressed events after processing items
This commit is contained in:
Rémi Verschelde 2018-08-14 09:37:54 +02:00 committed by GitHub
commit 98da0df894
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1049,10 +1049,8 @@ void PopupMenu::activate_item(int p_item) {
ERR_FAIL_INDEX(p_item, items.size()); ERR_FAIL_INDEX(p_item, items.size());
ERR_FAIL_COND(items[p_item].separator); ERR_FAIL_COND(items[p_item].separator);
int id = items[p_item].ID >= 0 ? items[p_item].ID : p_item; 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(); Node *next = get_parent();
PopupMenu *pop = Object::cast_to<PopupMenu>(next); PopupMenu *pop = Object::cast_to<PopupMenu>(next);
while (pop) { while (pop) {
@ -1086,6 +1084,9 @@ void PopupMenu::activate_item(int p_item) {
return; return;
hide(); hide();
emit_signal("id_pressed", id);
emit_signal("index_pressed", p_item);
} }
void PopupMenu::remove_item(int p_idx) { void PopupMenu::remove_item(int p_idx) {