diff options
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/base_button.cpp | 2 | ||||
-rw-r--r-- | scene/gui/box_container.cpp | 8 | ||||
-rw-r--r-- | scene/gui/center_container.cpp | 4 | ||||
-rw-r--r-- | scene/gui/color_picker.cpp | 2 | ||||
-rw-r--r-- | scene/gui/container.cpp | 2 | ||||
-rw-r--r-- | scene/gui/control.cpp | 34 | ||||
-rw-r--r-- | scene/gui/control.h | 2 | ||||
-rw-r--r-- | scene/gui/dialogs.cpp | 4 | ||||
-rw-r--r-- | scene/gui/file_dialog.cpp | 2 | ||||
-rw-r--r-- | scene/gui/graph_edit.cpp | 2 | ||||
-rw-r--r-- | scene/gui/graph_node.cpp | 10 | ||||
-rw-r--r-- | scene/gui/margin_container.cpp | 4 | ||||
-rw-r--r-- | scene/gui/panel_container.cpp | 4 | ||||
-rw-r--r-- | scene/gui/popup.cpp | 4 | ||||
-rw-r--r-- | scene/gui/popup_menu.cpp | 20 | ||||
-rw-r--r-- | scene/gui/popup_menu.h | 2 | ||||
-rw-r--r-- | scene/gui/range.cpp | 2 | ||||
-rw-r--r-- | scene/gui/rich_text_label.cpp | 10 | ||||
-rw-r--r-- | scene/gui/rich_text_label.h | 1 | ||||
-rw-r--r-- | scene/gui/scroll_container.cpp | 16 | ||||
-rw-r--r-- | scene/gui/split_container.cpp | 2 | ||||
-rw-r--r-- | scene/gui/tab_container.cpp | 6 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 7 |
23 files changed, 78 insertions, 72 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 211082d610..2e77d20d4e 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -345,7 +345,7 @@ String BaseButton::get_tooltip(const Point2 &p_pos) const { String tooltip = Control::get_tooltip(p_pos); if (shortcut_in_tooltip && shortcut.is_valid() && shortcut->is_valid()) { String text = shortcut->get_name() + " (" + shortcut->get_as_text() + ")"; - if (shortcut->get_name().nocasecmp_to(tooltip) != 0) { + if (tooltip != String() && shortcut->get_name().nocasecmp_to(tooltip) != 0) { text += "\n" + tooltip; } tooltip = text; diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp index f130726837..33e030a573 100644 --- a/scene/gui/box_container.cpp +++ b/scene/gui/box_container.cpp @@ -57,7 +57,7 @@ void BoxContainer::_resort() { if (!c || !c->is_visible_in_tree()) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } @@ -111,7 +111,7 @@ void BoxContainer::_resort() { if (!c || !c->is_visible_in_tree()) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } @@ -172,7 +172,7 @@ void BoxContainer::_resort() { if (!c || !c->is_visible_in_tree()) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } @@ -224,7 +224,7 @@ Size2 BoxContainer::get_minimum_size() const { if (!c) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } diff --git a/scene/gui/center_container.cpp b/scene/gui/center_container.cpp index f8f9bec3d7..1a72f3ca4d 100644 --- a/scene/gui/center_container.cpp +++ b/scene/gui/center_container.cpp @@ -40,7 +40,7 @@ Size2 CenterContainer::get_minimum_size() const { if (!c) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } if (!c->is_visible()) { @@ -77,7 +77,7 @@ void CenterContainer::_notification(int p_what) { if (!c) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index cbe0367c7b..f8a67d154b 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -610,7 +610,7 @@ void ColorPicker::_screen_pick_pressed() { if (!screen) { screen = memnew(Control); r->add_child(screen); - screen->set_as_toplevel(true); + screen->set_as_top_level(true); screen->set_anchors_and_margins_preset(Control::PRESET_WIDE); screen->set_default_cursor_shape(CURSOR_POINTING_HAND); screen->connect("gui_input", callable_mp(this, &ColorPicker::_screen_input)); diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index a89eef6209..470a7db2dc 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -168,7 +168,7 @@ String Container::get_configuration_warning() const { String warning = Control::get_configuration_warning(); if (get_class() == "Container" && get_script().is_null()) { - if (warning != String()) { + if (!warning.empty()) { warning += "\n\n"; } warning += TTR("Container by itself serves no purpose unless a script configures its children placement behavior.\nIf you don't intend to add a script, use a plain Control node instead."); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 2cdee4641e..476dccab7e 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -493,7 +493,7 @@ void Control::_notification(int p_notification) { } CanvasItem *ci = Object::cast_to<CanvasItem>(parent); - if (ci && ci->is_set_as_toplevel()) { + if (ci && ci->is_set_as_top_level()) { subwindow = true; break; } @@ -509,13 +509,13 @@ void Control::_notification(int p_notification) { } if (parent_control && !subwindow) { - //do nothing, has a parent control and not toplevel + //do nothing, has a parent control and not top_level if (data.theme.is_null() && parent_control->data.theme_owner) { data.theme_owner = parent_control->data.theme_owner; notification(NOTIFICATION_THEME_CHANGED); } } else { - //is a regular root control or toplevel + //is a regular root control or top_level data.RI = get_viewport()->_gui_add_root_control(this); } @@ -532,7 +532,7 @@ void Control::_notification(int p_notification) { if (data.parent_canvas_item) { data.parent_canvas_item->disconnect("item_rect_changed", callable_mp(this, &Control::_size_changed)); data.parent_canvas_item = nullptr; - } else if (!is_set_as_toplevel()) { + } else if (!is_set_as_top_level()) { //disconnect viewport get_viewport()->disconnect("size_changed", callable_mp(this, &Control::_size_changed)); } @@ -591,7 +591,7 @@ void Control::_notification(int p_notification) { case NOTIFICATION_VISIBILITY_CHANGED: { if (!is_visible_in_tree()) { if (get_viewport() != nullptr) { - get_viewport()->_gui_hid_control(this); + get_viewport()->_gui_hide_control(this); } //remove key focus @@ -1816,7 +1816,7 @@ void Control::set_focus_mode(FocusMode p_focus_mode) { } static Control *_next_control(Control *p_from) { - if (p_from->is_set_as_toplevel()) { + if (p_from->is_set_as_top_level()) { return nullptr; // can't go above } @@ -1830,7 +1830,7 @@ static Control *_next_control(Control *p_from) { ERR_FAIL_INDEX_V(next, parent->get_child_count(), nullptr); for (int i = (next + 1); i < parent->get_child_count(); i++) { Control *c = Object::cast_to<Control>(parent->get_child(i)); - if (!c || !c->is_visible_in_tree() || c->is_set_as_toplevel()) { + if (!c || !c->is_visible_in_tree() || c->is_set_as_top_level()) { continue; } @@ -1867,7 +1867,7 @@ Control *Control::find_next_valid_focus() const { for (int i = 0; i < from->get_child_count(); i++) { Control *c = Object::cast_to<Control>(from->get_child(i)); - if (!c || !c->is_visible_in_tree() || c->is_set_as_toplevel()) { + if (!c || !c->is_visible_in_tree() || c->is_set_as_top_level()) { continue; } @@ -1879,7 +1879,7 @@ Control *Control::find_next_valid_focus() const { next_child = _next_control(from); if (!next_child) { //nothing else.. go up and find either window or subwindow next_child = const_cast<Control *>(this); - while (next_child && !next_child->is_set_as_toplevel()) { + while (next_child && !next_child->is_set_as_top_level()) { next_child = cast_to<Control>(next_child->get_parent()); } @@ -1915,7 +1915,7 @@ static Control *_prev_control(Control *p_from) { Control *child = nullptr; for (int i = p_from->get_child_count() - 1; i >= 0; i--) { Control *c = Object::cast_to<Control>(p_from->get_child(i)); - if (!c || !c->is_visible_in_tree() || c->is_set_as_toplevel()) { + if (!c || !c->is_visible_in_tree() || c->is_set_as_top_level()) { continue; } @@ -1955,7 +1955,7 @@ Control *Control::find_prev_valid_focus() const { Control *prev_child = nullptr; - if (from->is_set_as_toplevel() || !Object::cast_to<Control>(from->get_parent())) { + if (from->is_set_as_top_level() || !Object::cast_to<Control>(from->get_parent())) { //find last of the children prev_child = _prev_control(from); @@ -1964,7 +1964,7 @@ Control *Control::find_prev_valid_focus() const { for (int i = (from->get_index() - 1); i >= 0; i--) { Control *c = Object::cast_to<Control>(from->get_parent()->get_child(i)); - if (!c || !c->is_visible_in_tree() || c->is_set_as_toplevel()) { + if (!c || !c->is_visible_in_tree() || c->is_set_as_top_level()) { continue; } @@ -2023,8 +2023,8 @@ void Control::release_focus() { update(); } -bool Control::is_toplevel_control() const { - return is_inside_tree() && (!data.parent_canvas_item && !data.RI && is_set_as_toplevel()); +bool Control::is_top_level_control() const { + return is_inside_tree() && (!data.parent_canvas_item && !data.RI && is_set_as_top_level()); } void Control::_propagate_theme_changed(Node *p_at, Control *p_owner, Window *p_owner_window, bool p_assign) { @@ -2374,7 +2374,7 @@ void Control::minimum_size_changed() { //invalidate cache upwards while (invalidate && invalidate->data.minimum_size_valid) { invalidate->data.minimum_size_valid = false; - if (invalidate->is_set_as_toplevel()) { + if (invalidate->is_set_as_top_level()) { break; // do not go further up } if (!invalidate->data.parent && get_parent()) { @@ -2499,7 +2499,7 @@ Control *Control::get_root_parent_control() const { if (c) { root = c; - if (c->data.RI || c->is_toplevel_control()) { + if (c->data.RI || c->is_top_level_control()) { break; } } @@ -2560,7 +2560,7 @@ String Control::get_configuration_warning() const { String warning = CanvasItem::get_configuration_warning(); if (data.mouse_filter == MOUSE_FILTER_IGNORE && data.tooltip != "") { - if (warning != String()) { + if (!warning.empty()) { warning += "\n\n"; } warning += TTR("The Hint Tooltip won't be displayed as the control's Mouse Filter is set to \"Ignore\". To solve this, set the Mouse Filter to \"Stop\" or \"Pass\"."); diff --git a/scene/gui/control.h b/scene/gui/control.h index 15e10df0c6..83e79f908f 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -464,7 +464,7 @@ public: virtual Transform2D get_transform() const override; - bool is_toplevel_control() const; + bool is_top_level_control() const; Size2 get_parent_area_size() const; Rect2 get_parent_anchorable_rect() const; diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 9077bfa4ba..430e98d50e 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -181,7 +181,7 @@ void AcceptDialog::_update_child_rects() { continue; } - if (c == hbc || c == label || c == bg || c->is_set_as_toplevel()) { + if (c == hbc || c == label || c == bg || c->is_set_as_top_level()) { continue; } @@ -209,7 +209,7 @@ Size2 AcceptDialog::_get_contents_minimum_size() const { continue; } - if (c == hbc || c == label || c->is_set_as_toplevel()) { + if (c == hbc || c == label || c->is_set_as_top_level()) { continue; } diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 4aea2928f4..2da61bdde7 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -936,7 +936,7 @@ FileDialog::FileDialog() { filter->connect("item_selected", callable_mp(this, &FileDialog::_filter_selected)); confirm_save = memnew(ConfirmationDialog); - // confirm_save->set_as_toplevel(true); + // confirm_save->set_as_top_level(true); add_child(confirm_save); confirm_save->connect("confirmed", callable_mp(this, &FileDialog::_save_confirm_pressed)); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 467d252c81..a7c15e7027 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -547,7 +547,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) { } bool GraphEdit::_check_clickable_control(Control *p_control, const Vector2 &pos) { - if (p_control->is_set_as_toplevel() || !p_control->is_visible()) { + if (p_control->is_set_as_top_level() || !p_control->is_visible()) { return false; } diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index 01b54ddaa8..38bf31830f 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -102,7 +102,7 @@ void GraphNode::_get_property_list(List<PropertyInfo> *p_list) const { int idx = 0; for (int i = 0; i < get_child_count(); i++) { Control *c = Object::cast_to<Control>(get_child(i)); - if (!c || c->is_set_as_toplevel()) { + if (!c || c->is_set_as_top_level()) { continue; } @@ -131,7 +131,7 @@ void GraphNode::_resort() { if (!c) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } @@ -156,7 +156,7 @@ void GraphNode::_resort() { if (!c) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } @@ -388,7 +388,7 @@ Size2 GraphNode::get_minimum_size() const { if (!c) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } @@ -477,7 +477,7 @@ void GraphNode::_connpos_update() { if (!c) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } diff --git a/scene/gui/margin_container.cpp b/scene/gui/margin_container.cpp index 0299065f77..b674b492d8 100644 --- a/scene/gui/margin_container.cpp +++ b/scene/gui/margin_container.cpp @@ -43,7 +43,7 @@ Size2 MarginContainer::get_minimum_size() const { if (!c) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } if (!c->is_visible()) { @@ -80,7 +80,7 @@ void MarginContainer::_notification(int p_what) { if (!c) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } diff --git a/scene/gui/panel_container.cpp b/scene/gui/panel_container.cpp index 9abdfac009..051b4de825 100644 --- a/scene/gui/panel_container.cpp +++ b/scene/gui/panel_container.cpp @@ -45,7 +45,7 @@ Size2 PanelContainer::get_minimum_size() const { if (!c || !c->is_visible()) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } @@ -95,7 +95,7 @@ void PanelContainer::_notification(int p_what) { if (!c || !c->is_visible_in_tree()) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 8a65aa5032..de866fa956 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -191,7 +191,7 @@ Size2 PopupPanel::_get_contents_minimum_size() const { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } @@ -215,7 +215,7 @@ void PopupPanel::_update_child_rects() { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index bc70809ad5..578d8a96e8 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -305,12 +305,14 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) { during_grabbed_click = false; initial_button_mask = 0; - int over = _get_mouse_over(b->get_position()); - - if (invalidated_click) { - invalidated_click = false; + // Disable clicks under a time threshold to avoid selection right when opening the popup. + uint64_t now = OS::get_singleton()->get_ticks_msec(); + uint64_t diff = now - popup_time_msec; + if (diff < 100) { return; } + + int over = _get_mouse_over(b->get_position()); if (over < 0) { if (!was_during_grabbed_click) { hide(); @@ -338,13 +340,6 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) { return; } - if (invalidated_click) { - moved += m->get_relative(); - if (moved.length() > 4) { - invalidated_click = false; - } - } - for (List<Rect2>::Element *E = autohide_areas.front(); E; E = E->next()) { if (!Rect2(Point2(), get_size()).has_point(m->get_position()) && E->get().has_point(m->get_position())) { _close_pressed(); @@ -1443,7 +1438,7 @@ void PopupMenu::_bind_methods() { void PopupMenu::popup(const Rect2 &p_bounds) { moved = Vector2(); - invalidated_click = true; + popup_time_msec = OS::get_singleton()->get_ticks_msec(); set_as_minsize(); Popup::popup(p_bounds); } @@ -1475,7 +1470,6 @@ PopupMenu::PopupMenu() { submenu_over = -1; initial_button_mask = 0; during_grabbed_click = false; - invalidated_click = false; allow_search = true; search_time_msec = 0; diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h index 9535fd07d7..e8f82ba869 100644 --- a/scene/gui/popup_menu.h +++ b/scene/gui/popup_menu.h @@ -105,7 +105,7 @@ class PopupMenu : public Popup { void _activate_submenu(int over); void _submenu_timeout(); - bool invalidated_click; + uint64_t popup_time_msec = 0; bool hide_on_item_selection; bool hide_on_checkable_item_selection; bool hide_on_multistate_item_selection; diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 59e26d9e38..bdb9f408f0 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -34,7 +34,7 @@ String Range::get_configuration_warning() const { String warning = Control::get_configuration_warning(); if (shared->exp_ratio && shared->min <= 0) { - if (warning != String()) { + if (!warning.empty()) { warning += "\n\n"; } warning += TTR("If \"Exp Edit\" is enabled, \"Min Value\" must be greater than 0."); diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index fb4931ea91..e8acac172c 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -2529,9 +2529,9 @@ bool RichTextLabel::search(const String &p_string, bool p_from_selection, bool p return false; } -void RichTextLabel::selection_copy() { +String RichTextLabel::get_selected_text() { if (!selection.active || !selection.enabled) { - return; + return ""; } String text; @@ -2561,6 +2561,12 @@ void RichTextLabel::selection_copy() { item = _get_next_item(item, true); } + return text; +} + +void RichTextLabel::selection_copy() { + String text = get_selected_text(); + if (text != "") { DisplayServer::get_singleton()->clipboard_set(text); } diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h index 2bda7c7fce..c5ed1cb3ef 100644 --- a/scene/gui/rich_text_label.h +++ b/scene/gui/rich_text_label.h @@ -475,6 +475,7 @@ public: void set_selection_enabled(bool p_enabled); bool is_selection_enabled() const; + String get_selected_text(); void selection_copy(); Error parse_bbcode(const String &p_bbcode); diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index b72b913af0..f4e31c45d2 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -45,7 +45,7 @@ Size2 ScrollContainer::get_minimum_size() const { if (!c) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } if (c == h_scroll || c == v_scroll) { @@ -285,7 +285,7 @@ void ScrollContainer::_notification(int p_what) { if (!c) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } if (c == h_scroll || c == v_scroll) { @@ -520,6 +520,8 @@ void ScrollContainer::set_follow_focus(bool p_follow) { } String ScrollContainer::get_configuration_warning() const { + String warning = Container::get_configuration_warning(); + int found = 0; for (int i = 0; i < get_child_count(); i++) { @@ -527,7 +529,7 @@ String ScrollContainer::get_configuration_warning() const { if (!c) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } if (c == h_scroll || c == v_scroll) { @@ -538,10 +540,12 @@ String ScrollContainer::get_configuration_warning() const { } if (found != 1) { - return TTR("ScrollContainer is intended to work with a single child control.\nUse a container as child (VBox, HBox, etc.), or a Control and set the custom minimum size manually."); - } else { - return ""; + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("ScrollContainer is intended to work with a single child control.\nUse a container as child (VBox, HBox, etc.), or a Control and set the custom minimum size manually."); } + return warning; } HScrollBar *ScrollContainer::get_h_scrollbar() { diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp index 5c60153d91..6508be1e43 100644 --- a/scene/gui/split_container.cpp +++ b/scene/gui/split_container.cpp @@ -41,7 +41,7 @@ Control *SplitContainer::_getch(int p_idx) const { if (!c || !c->is_visible_in_tree()) { continue; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { continue; } diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 41b8fad49d..a1f93094c4 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -478,7 +478,7 @@ void TabContainer::_on_mouse_exited() { int TabContainer::_get_tab_width(int p_index) const { ERR_FAIL_INDEX_V(p_index, get_tab_count(), 0); Control *control = Object::cast_to<Control>(_get_tabs()[p_index]); - if (!control || control->is_set_as_toplevel() || get_tab_hidden(p_index)) { + if (!control || control->is_set_as_top_level() || get_tab_hidden(p_index)) { return 0; } @@ -517,7 +517,7 @@ Vector<Control *> TabContainer::_get_tabs() const { Vector<Control *> controls; for (int i = 0; i < get_child_count(); i++) { Control *control = Object::cast_to<Control>(get_child(i)); - if (!control || control->is_toplevel_control()) { + if (!control || control->is_top_level_control()) { continue; } @@ -537,7 +537,7 @@ void TabContainer::add_child_notify(Node *p_child) { if (!c) { return; } - if (c->is_set_as_toplevel()) { + if (c->is_set_as_top_level()) { return; } diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index f6636cf392..2f5ee20373 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1208,8 +1208,9 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 if (drop_mode_flags && drop_mode_over == p_item) { Rect2 r = cell_rect; + bool has_parent = p_item->get_children() != nullptr; - if (drop_mode_section == -1 || drop_mode_section == 0) { + if (drop_mode_section == -1 || has_parent || drop_mode_section == 0) { RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y, r.size.x, 1), cache.drop_position_color); } @@ -1218,7 +1219,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x + r.size.x - 1, r.position.y, 1, r.size.y), cache.drop_position_color); } - if (drop_mode_section == 1 || drop_mode_section == 0) { + if ((drop_mode_section == 1 && !has_parent) || drop_mode_section == 0) { RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y + r.size.y, r.size.x, 1), cache.drop_position_color); } } @@ -3891,7 +3892,7 @@ Tree::Tree() { popup_menu = memnew(PopupMenu); popup_menu->hide(); add_child(popup_menu); - // popup_menu->set_as_toplevel(true); + // popup_menu->set_as_top_level(true); popup_editor = memnew(Popup); popup_editor->set_wrap_controls(true); |