diff options
Diffstat (limited to 'scene/gui/container.cpp')
-rw-r--r-- | scene/gui/container.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index 03bade6702..11941529cd 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -47,9 +47,9 @@ void Container::add_child_notify(Node *p_child) { return; } - control->connect("size_flags_changed", callable_mp(this, &Container::queue_sort)); - control->connect("minimum_size_changed", callable_mp(this, &Container::_child_minsize_changed)); - control->connect("visibility_changed", callable_mp(this, &Container::_child_minsize_changed)); + control->connect(SNAME("size_flags_changed"), callable_mp(this, &Container::queue_sort)); + control->connect(SNAME("minimum_size_changed"), callable_mp(this, &Container::_child_minsize_changed)); + control->connect(SNAME("visibility_changed"), callable_mp(this, &Container::_child_minsize_changed)); minimum_size_changed(); queue_sort(); @@ -96,17 +96,18 @@ void Container::fit_child_in_rect(Control *p_child, const Rect2 &p_rect) { ERR_FAIL_COND(!p_child); ERR_FAIL_COND(p_child->get_parent() != this); + bool rtl = is_layout_rtl(); Size2 minsize = p_child->get_combined_minimum_size(); Rect2 r = p_rect; if (!(p_child->get_h_size_flags() & SIZE_FILL)) { r.size.x = minsize.width; if (p_child->get_h_size_flags() & SIZE_SHRINK_END) { - r.position.x += p_rect.size.width - minsize.width; + r.position.x += rtl ? 0 : (p_rect.size.width - minsize.width); } else if (p_child->get_h_size_flags() & SIZE_SHRINK_CENTER) { r.position.x += Math::floor((p_rect.size.x - minsize.width) / 2); } else { - r.position.x += 0; + r.position.x += rtl ? (p_rect.size.width - minsize.width) : 0; } } @@ -159,16 +160,14 @@ void Container::_notification(int p_what) { } } -String Container::get_configuration_warning() const { - String warning = Control::get_configuration_warning(); +TypedArray<String> Container::get_configuration_warnings() const { + TypedArray<String> warnings = Control::get_configuration_warnings(); if (get_class() == "Container" && get_script().is_null()) { - if (!warning.is_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."); + warnings.push_back(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.")); } - return warning; + + return warnings; } void Container::_bind_methods() { @@ -180,7 +179,6 @@ void Container::_bind_methods() { } Container::Container() { - pending_sort = false; // All containers should let mouse events pass by default. set_mouse_filter(MOUSE_FILTER_PASS); } |