1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

Userland: Specify margins and spacing in the GUI::Layout constructor

This commit is contained in:
Sam Atkins 2023-02-16 21:07:06 +00:00 committed by Sam Atkins
parent 9561ec15f4
commit 77ad0fdb07
64 changed files with 136 additions and 288 deletions

View file

@ -435,16 +435,12 @@ ErrorOr<void> MainWidget::add_property_tab(PropertyTab const& property_tab)
auto properties_list = TRY(GUI::Widget::try_create());
scrollable_container->set_widget(properties_list);
(void)TRY(properties_list->try_set_layout<GUI::VerticalBoxLayout>());
properties_list->layout()->set_spacing(12);
properties_list->layout()->set_margins({ 8 });
(void)TRY(properties_list->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 8 }, 12));
for (auto const& group : property_tab.property_groups) {
NonnullRefPtr<GUI::GroupBox> group_box = TRY(properties_list->try_add<GUI::GroupBox>(group.title));
(void)TRY(group_box->try_set_layout<GUI::VerticalBoxLayout>());
group_box->layout()->set_spacing(12);
// 1px less on the left makes the text line up with the group title.
group_box->layout()->set_margins({ 8, 8, 8, 7 });
(void)TRY(group_box->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 8, 8, 8, 7 }, 12));
group_box->set_preferred_height(GUI::SpecialDimension::Fit);
for (auto const& property : group.properties) {