Merge pull request #118651 from StarryWorm/fix-tabbar-label-max-width

Fix `TabBar` and `Label` being unable to shrink when given a maximum size
This commit is contained in:
Thaddeus Crews
2026-05-07 16:22:27 -05:00
33 changed files with 454 additions and 72 deletions
+11 -3
View File
@@ -996,13 +996,13 @@ bool GraphNode::is_ignoring_valid_connection_type() const {
return ignore_invalid_connection_type;
}
Size2 GraphNode::get_minimum_size() const {
Size2 GraphNode::_get_minimum_size(bool p_use_desired_sizes) const {
Ref<StyleBox> sb_panel = theme_cache.panel;
Ref<StyleBox> sb_titlebar = theme_cache.titlebar;
Ref<StyleBox> sb_slot = theme_cache.slot;
int separation = theme_cache.separation;
Size2 minsize = titlebar_hbox->get_minimum_size() + sb_titlebar->get_minimum_size();
Size2 minsize = (p_use_desired_sizes ? titlebar_hbox->get_bound_desired_size() : titlebar_hbox->get_minimum_size()) + sb_titlebar->get_minimum_size();
for (int i = 0; i < get_child_count(false); i++) {
Control *child = as_sortable_control(get_child(i, false));
@@ -1010,7 +1010,7 @@ Size2 GraphNode::get_minimum_size() const {
continue;
}
Size2i size = child->get_bound_minimum_size();
Size2i size = p_use_desired_sizes ? child->get_bound_desired_size() : child->get_bound_minimum_size();
size.width += sb_panel->get_minimum_size().width;
if (slot_table.has(i)) {
size += slot_table[i].draw_stylebox ? sb_slot->get_minimum_size() : Size2();
@@ -1029,6 +1029,14 @@ Size2 GraphNode::get_minimum_size() const {
return minsize;
}
Size2 GraphNode::get_minimum_size() const {
return _get_minimum_size(false);
}
Size2 GraphNode::get_desired_size() const {
return _get_minimum_size(true);
}
void GraphNode::_port_pos_update() {
int edgeofs = theme_cache.port_h_offset;
int separation = theme_cache.separation;