diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2023-01-11 01:29:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-11 01:29:51 +0100 |
commit | 3e2843e3ad7b43940133ca0f67adf08f9da31a9b (patch) | |
tree | 9856da8e6db4d5327dc6a06e5f4217f4f9bc4af8 /scene/gui | |
parent | cbe3841a43586409b0c15e8e33bf2f989bf5f0c9 (diff) | |
parent | 42cbdbc7df9e71c0ad806c8e6321794a23d912ad (diff) |
Merge pull request #71183 from YuriSizov/control-refresh-layouts-by-parents
Ensure that the cached layout mode is in sync
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/control.cpp | 10 | ||||
-rw-r--r-- | scene/gui/control.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 6e85ae5c0e..4188946494 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -864,6 +864,14 @@ void Control::_set_layout_mode(LayoutMode p_mode) { } } +void Control::_update_layout_mode() { + LayoutMode computed_layout = _get_layout_mode(); + if (data.stored_layout_mode != computed_layout) { + data.stored_layout_mode = computed_layout; + notify_property_list_changed(); + } +} + Control::LayoutMode Control::_get_layout_mode() const { Node *parent_node = get_parent_control(); // In these modes the property is read-only. @@ -2894,6 +2902,8 @@ void Control::_notification(int p_notification) { data.parent_window = Object::cast_to<Window>(parent_node); data.theme_owner->assign_theme_on_parented(this); + + _update_layout_mode(); } break; case NOTIFICATION_UNPARENTED: { diff --git a/scene/gui/control.h b/scene/gui/control.h index 52efe42bd5..22a37dd89e 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -282,6 +282,7 @@ private: void _compute_anchors(Rect2 p_rect, const real_t p_offsets[4], real_t (&r_anchors)[4]); void _set_layout_mode(LayoutMode p_mode); + void _update_layout_mode(); LayoutMode _get_layout_mode() const; LayoutMode _get_default_layout_mode() const; void _set_anchors_layout_preset(int p_preset); |