summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-08-16 17:44:51 -0300
committerGitHub <noreply@github.com>2018-08-16 17:44:51 -0300
commitd7b892294b5385834c8d5e78d3da41e4217c7eab (patch)
treedd1ad6ffbfdfe81ea2607e5c14f7515d4ca1d338 /scene/gui
parent968b31e971da8040d939a38dcdfbc3445100daa8 (diff)
parentfa7eac8a0dfbd7271dcbdd398d4075c7f49d6836 (diff)
Merge pull request #21090 from hpvb/fix-19842-redux
Delay emitting pressed signals in PopupMenu
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/popup_menu.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index e81813d7a5..89a54d41b5 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -1071,22 +1071,26 @@ void PopupMenu::activate_item(int p_item) {
pop = Object::cast_to<PopupMenu>(next);
}
- emit_signal("id_pressed", id);
- emit_signal("index_pressed", p_item);
-
// Hides popup by default; unless otherwise specified
// by using set_hide_on_item_selection and set_hide_on_checkable_item_selection
+ bool need_hide = true;
+
if (items[p_item].checkable_type) {
if (!hide_on_checkable_item_selection)
- return;
+ need_hide = false;
} else if (0 < items[p_item].max_states) {
if (!hide_on_multistate_item_selection)
- return;
+ need_hide = false;
} else if (!hide_on_item_selection)
- return;
+ need_hide = false;
- hide();
+ emit_signal("id_pressed", id);
+ emit_signal("index_pressed", p_item);
+
+ if (need_hide) {
+ hide();
+ }
}
void PopupMenu::remove_item(int p_idx) {