diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-10-06 10:11:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-06 10:11:46 +0200 |
commit | 36de097577811eb39d1a8d31d10d538ad70675d9 (patch) | |
tree | 31e8f2c35c42b31e21b546a7af841096821dd8a4 | |
parent | 425f643e0534bd4c75624191859e375d1e801b65 (diff) | |
parent | 45e943f4fe9df34b86c649f99a91e5e8baeaf63c (diff) |
Merge pull request #53460 from timothyqiu/tooltip-request-func
-rw-r--r-- | scene/gui/text_edit.cpp | 4 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 57bcbb7c2d..6370ea9c95 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2399,6 +2399,7 @@ Control::CursorShape TextEdit::get_cursor_shape(const Point2 &p_pos) const { } String TextEdit::get_tooltip(const Point2 &p_pos) const { + Object *tooltip_obj = ObjectDB::get_instance(tooltip_obj_id); if (!tooltip_obj) { return Control::get_tooltip(p_pos); } @@ -2421,7 +2422,8 @@ String TextEdit::get_tooltip(const Point2 &p_pos) const { } void TextEdit::set_tooltip_request_func(Object *p_obj, const StringName &p_function, const Variant &p_udata) { - tooltip_obj = p_obj; + ERR_FAIL_NULL(p_obj); + tooltip_obj_id = p_obj->get_instance_id(); tooltip_func = p_function; tooltip_ud = p_udata; } diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 07e585847a..3230de776f 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -330,7 +330,7 @@ private: int _get_column_pos_of_word(const String &p_key, const String &p_search, uint32_t p_search_flags, int p_from_column) const; /* Tooltip. */ - Object *tooltip_obj = nullptr; + ObjectID tooltip_obj_id; StringName tooltip_func; Variant tooltip_ud; |