diff options
| author | nathanwfranke <nathanwfranke@gmail.com> | 2020-01-24 18:34:47 -0600 |
|---|---|---|
| committer | nathanwfranke <nathanwfranke@gmail.com> | 2020-01-30 22:45:37 -0600 |
| commit | c0a84f747ea165369b1b4a6f531528368e9b8757 (patch) | |
| tree | 71e780b3ecb57fc2eda45a8ab95691c38aaeaf4b /scene/gui/tab_container.cpp | |
| parent | 3c3ed67c3944a555d18fa8b68603f3a68416e27e (diff) | |
| download | redot-engine-c0a84f747ea165369b1b4a6f531528368e9b8757.tar.gz | |
Fix tab container too large when tabs are hidden
Diffstat (limited to 'scene/gui/tab_container.cpp')
| -rw-r--r-- | scene/gui/tab_container.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index c3ddc41813..b045ff4fe1 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -785,23 +785,25 @@ TabContainer::TabAlign TabContainer::get_tab_align() const { return align; } -void TabContainer::set_tabs_visible(bool p_visibe) { +void TabContainer::set_tabs_visible(bool p_visible) { - if (p_visibe == tabs_visible) + if (p_visible == tabs_visible) return; - tabs_visible = p_visibe; + tabs_visible = p_visible; Vector<Control *> tabs = _get_tabs(); for (int i = 0; i < tabs.size(); i++) { Control *c = tabs[i]; - if (p_visibe) + if (p_visible) c->set_margin(MARGIN_TOP, _get_top_margin()); else c->set_margin(MARGIN_TOP, 0); } + update(); + minimum_size_changed(); } bool TabContainer::are_tabs_visible() const { @@ -936,8 +938,10 @@ Size2 TabContainer::get_minimum_size() const { Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled"); Ref<Font> font = get_font("font"); - ms.y += MAX(MAX(tab_bg->get_minimum_size().y, tab_fg->get_minimum_size().y), tab_disabled->get_minimum_size().y); - ms.y += font->get_height(); + if (tabs_visible) { + ms.y += MAX(MAX(tab_bg->get_minimum_size().y, tab_fg->get_minimum_size().y), tab_disabled->get_minimum_size().y); + ms.y += font->get_height(); + } Ref<StyleBox> sb = get_stylebox("panel"); ms += sb->get_minimum_size(); |
