fix boxlayout adding extra spacing

This commit is contained in:
hippoz 2022-07-29 03:02:54 +03:00
parent 55b8353d6d
commit c02f286f01
No known key found for this signature in database
GPG key ID: 7C52899193467641

View file

@ -57,7 +57,13 @@ void BoxLayout::run() {
} }
} }
double space_per_unslotted_widget = free_space / unslotted_widgets - m_spacing; double spacing_targets = (unslotted_widgets - 1);
if (spacing_targets < 0)
spacing_targets = 0;
free_space -= spacing_targets * m_spacing;
double space_per_unslotted_widget = free_space / unslotted_widgets;
for (unsigned int i = 0; i < m_target->children().size(); i++) { for (unsigned int i = 0; i < m_target->children().size(); i++) {
auto child = m_target->children()[i]; auto child = m_target->children()[i];