diff options
author | kobewi <kobewi4e@gmail.com> | 2023-03-20 00:38:00 +0100 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-03-27 17:37:13 +0200 |
commit | 94e90b05934628b29678f246c23101fff17cac86 (patch) | |
tree | e5cb3bf5466c01829c4f6c776d8240d5688a1401 /scene | |
parent | 9559bbcb182a8822c7226abed0bcc734d861da3e (diff) |
Fix get_drag_data not overridable in some Controls
(cherry picked from commit 36141dc469baaf027e753718598b32c15fe7c541)
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/line_edit.cpp | 5 | ||||
-rw-r--r-- | scene/gui/rich_text_label.cpp | 5 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 5 |
3 files changed, 15 insertions, 0 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index fa0f93d12f..6b2faf1a40 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -638,6 +638,11 @@ HorizontalAlignment LineEdit::get_horizontal_alignment() const { } Variant LineEdit::get_drag_data(const Point2 &p_point) { + Variant ret = Control::get_drag_data(p_point); + if (ret != Variant()) { + return ret; + } + if (selection.drag_attempt && selection.enabled) { String t = text.substr(selection.begin, selection.end - selection.begin); Label *l = memnew(Label); diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index ec1fbb7e28..68e12b9bb5 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -4735,6 +4735,11 @@ void RichTextLabel::set_deselect_on_focus_loss_enabled(const bool p_enabled) { } Variant RichTextLabel::get_drag_data(const Point2 &p_point) { + Variant ret = Control::get_drag_data(p_point); + if (ret != Variant()) { + return ret; + } + if (selection.drag_attempt && selection.enabled) { String t = get_selected_text(); Label *l = memnew(Label); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index f8a1345576..30bac0f58c 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3035,6 +3035,11 @@ bool TextEdit::is_text_field() const { } Variant TextEdit::get_drag_data(const Point2 &p_point) { + Variant ret = Control::get_drag_data(p_point); + if (ret != Variant()) { + return ret; + } + if (has_selection() && selection_drag_attempt) { String t = get_selected_text(); Label *l = memnew(Label); |