diff options
author | Alexander Holland <alexander.holland@haw-hamburg.de> | 2015-08-12 22:24:21 +0200 |
---|---|---|
committer | Alexander Holland <alexander.holland@haw-hamburg.de> | 2015-08-12 22:24:21 +0200 |
commit | cff2509ecd06967c0d214dc0cf3d31c392091c99 (patch) | |
tree | c680c158ed7d8ce7638cd47fe60cf191b06dcd65 /scene/gui/popup_menu.cpp | |
parent | c2e2f2e0aebf6342e6f18ae5d67b6a825590675a (diff) |
close all parent PopupMenus fix
Diffstat (limited to 'scene/gui/popup_menu.cpp')
-rw-r--r-- | scene/gui/popup_menu.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index e706053592..275965b372 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -738,10 +738,18 @@ int PopupMenu::find_item_by_accelerator(uint32_t p_accel) const { void PopupMenu::activate_item(int p_item) { - ERR_FAIL_INDEX(p_item,items.size()); ERR_FAIL_COND(items[p_item].separator); emit_signal("item_pressed",items[p_item].ID); + + //hide all parent PopupMenue's + Node *next = get_parent(); + PopupMenu *pop = next->cast_to<PopupMenu>(); + while (pop) { + pop->hide(); + next = next->get_parent(); + pop = next->cast_to<PopupMenu>(); + } hide(); } |