summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Alexsander <michaelalexsander@protonmail.com>2021-08-28 15:43:02 +0000
committerGitHub <noreply@github.com>2021-08-28 15:43:02 +0000
commit565ba91d28cfd1d2b223e8bb2825e233bfdb25bf (patch)
tree68cf3be81d623d558e1d500a31d0e208cfacfac2
parentdcf2d09231c03c444cf5374b4d250f327f1333e4 (diff)
parent6f3d8fa228c6b4719206efe0db137356fabfa7f7 (diff)
Merge pull request #51906 from requizm/fix/49077
Fix tooltips don't appear for PopupMenus
-rw-r--r--scene/gui/popup_menu.cpp1
-rw-r--r--scene/main/viewport.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index f75d6755a8..c37095a9f8 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -228,6 +228,7 @@ void PopupMenu::_activate_submenu(int p_over) {
// Set autohide areas
PopupMenu *submenu_pum = Object::cast_to<PopupMenu>(submenu_popup);
if (submenu_pum) {
+ submenu_pum->take_mouse_focus();
// Make the position of the parent popup relative to submenu popup
this_rect.position = this_rect.position - submenu_pum->get_position();
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 6e0b161e54..8ec8c193fb 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -46,6 +46,7 @@
#include "scene/gui/control.h"
#include "scene/gui/label.h"
#include "scene/gui/popup.h"
+#include "scene/gui/popup_menu.h"
#include "scene/main/canvas_layer.h"
#include "scene/main/window.h"
#include "scene/resources/mesh.h"
@@ -1101,6 +1102,12 @@ String Viewport::_gui_get_tooltip(Control *p_control, const Vector2 &p_pos, Cont
while (p_control) {
tooltip = p_control->get_tooltip(pos);
+ //Temporary solution for PopupMenus
+ PopupMenu *menu = Object::cast_to<PopupMenu>(this);
+ if (menu) {
+ tooltip = menu->get_tooltip(pos);
+ }
+
if (r_tooltip_owner) {
*r_tooltip_owner = p_control;
}