Skip to content

Commit

Permalink
Merge pull request #53461 from timothyqiu/tooltip-request-func-3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Oct 6, 2021
2 parents 3f05c38 + 52a840b commit 3e2bb41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions scene/gui/text_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6801,6 +6801,7 @@ String TextEdit::get_word_at_pos(const Vector2 &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);
}
Expand All @@ -6822,7 +6823,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;
}
Expand Down Expand Up @@ -7368,7 +7370,7 @@ TextEdit::TextEdit() {
completion_enabled = false;
completion_active = false;
completion_line_ofs = 0;
tooltip_obj = nullptr;
tooltip_obj_id = ObjectID();
line_numbers = false;
line_numbers_zero_padded = false;
line_length_guidelines = false;
Expand Down
2 changes: 1 addition & 1 deletion scene/gui/text_edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class TextEdit : public Control {
VScrollBar *v_scroll;
bool updating_scrolls;

Object *tooltip_obj;
ObjectID tooltip_obj_id;
StringName tooltip_func;
Variant tooltip_ud;

Expand Down

0 comments on commit 3e2bb41

Please sign in to comment.