1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:17:35 +00:00

LibGUI: Make GUI::TabWidget::add_tab<T>() return a T&

Since the newly constructed sub-widget is owned by the TabWidget,
we can simply return a T& here. :^)
This commit is contained in:
Andreas Kling 2020-04-04 11:10:07 +02:00
parent 37af1d74cc
commit 2463a285ee
6 changed files with 41 additions and 41 deletions

View file

@ -107,21 +107,21 @@ void ColorPicker::build_ui()
auto& tab_widget = root_container.add<GUI::TabWidget>();
auto tab_palette = tab_widget.add_tab<Widget>("Palette");
tab_palette->set_size_policy(SizePolicy::Fill, SizePolicy::Fill);
tab_palette->set_layout<VerticalBoxLayout>();
tab_palette->layout()->set_margins({ 4, 4, 4, 4 });
tab_palette->layout()->set_spacing(4);
auto& tab_palette = tab_widget.add_tab<Widget>("Palette");
tab_palette.set_size_policy(SizePolicy::Fill, SizePolicy::Fill);
tab_palette.set_layout<VerticalBoxLayout>();
tab_palette.layout()->set_margins({ 4, 4, 4, 4 });
tab_palette.layout()->set_spacing(4);
build_ui_palette(*tab_palette);
build_ui_palette(tab_palette);
auto tab_custom_color = tab_widget.add_tab<Widget>("Custom Color");
tab_custom_color->set_size_policy(SizePolicy::Fill, SizePolicy::Fill);
tab_custom_color->set_layout<VerticalBoxLayout>();
tab_custom_color->layout()->set_margins({ 4, 4, 4, 4 });
tab_custom_color->layout()->set_spacing(4);
auto& tab_custom_color = tab_widget.add_tab<Widget>("Custom Color");
tab_custom_color.set_size_policy(SizePolicy::Fill, SizePolicy::Fill);
tab_custom_color.set_layout<VerticalBoxLayout>();
tab_custom_color.layout()->set_margins({ 4, 4, 4, 4 });
tab_custom_color.layout()->set_spacing(4);
build_ui_custom(*tab_custom_color);
build_ui_custom(tab_custom_color);
auto& button_container = root_container.add<Widget>();
button_container.set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);