summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEricEzaM <itsjusteza@gmail.com>2021-04-26 00:53:50 +1000
committerEricEzaM <itsjusteza@gmail.com>2021-04-26 00:55:12 +1000
commit5346bb043a3dd6a0a33d0dd0c279b10225f4a46a (patch)
tree90f08fc7b78debd6141ca5ffacaae998835cd1d4
parent15a85fe9713668f8ba6143352fd27d419a96ba83 (diff)
Made default tooltips (non-custom ones) disappear on mouse enter.
Matches 3.X behaviour, but does not break custom tooltips where mouse interaction is needed.
-rw-r--r--scene/main/viewport.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 4c9ebe016e..83caca54ab 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1563,6 +1563,9 @@ void Viewport::_gui_show_tooltip() {
return;
}
+ // Popup window which houses the tooltip content.
+ TooltipPanel *panel = memnew(TooltipPanel);
+
// Controls can implement `make_custom_tooltip` to provide their own tooltip.
// This should be a Control node which will be added as child to a TooltipPanel.
Control *base_tooltip = tooltip_owner->make_custom_tooltip(tooltip_text);
@@ -1572,11 +1575,11 @@ void Viewport::_gui_show_tooltip() {
gui.tooltip_label = memnew(TooltipLabel);
gui.tooltip_label->set_text(tooltip_text);
base_tooltip = gui.tooltip_label;
+ panel->connect("mouse_entered", callable_mp(this, &Viewport::_gui_cancel_tooltip));
}
base_tooltip->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
- TooltipPanel *panel = memnew(TooltipPanel);
panel->set_transient(false);
panel->set_flag(Window::FLAG_NO_FOCUS, true);
panel->set_wrap_controls(true);