summaryrefslogtreecommitdiffstats
path: root/scene/gui/menu_button.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-04-29 17:28:49 +0200
committerGitHub <noreply@github.com>2019-04-29 17:28:49 +0200
commit7e87a410fa73db5a6a852690250db894d273b2ac (patch)
tree3d4c59faa271db6bcd11b8f60e20a74e213fba31 /scene/gui/menu_button.cpp
parent8b757e0fee83c7483004f6dcbad8f4d5d68c8371 (diff)
parentebe54833a9425ca5bed21def64d3e8aa66b1b788 (diff)
downloadredot-engine-7e87a410fa73db5a6a852690250db894d273b2ac.tar.gz
Merge pull request #28205 from mikolasan/26937-hide-popup-menu
Hide popup menu when OptionButton is hidden
Diffstat (limited to 'scene/gui/menu_button.cpp')
-rw-r--r--scene/gui/menu_button.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index a011b793de..5f21d73ab2 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -91,6 +91,16 @@ bool MenuButton::is_switch_on_hover() {
return switch_on_hover;
}
+void MenuButton::_notification(int p_what) {
+
+ if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
+
+ if (!is_visible_in_tree()) {
+ popup->hide();
+ }
+ }
+}
+
void MenuButton::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_popup"), &MenuButton::get_popup);