diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-04 09:46:23 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-04 14:26:16 +0100 |
commit | 0f3e57a6fb037f6a8133e8ec2be8f0889ff9bc19 (patch) | |
tree | 3fc1f6f91d7e00783792e98bd23f226e591d99a3 /Games/Minesweeper/main.cpp | |
parent | 4697195645a4c66930761c85685f5752dc777bba (diff) | |
download | serenity-0f3e57a6fb037f6a8133e8ec2be8f0889ff9bc19.zip |
LibGUI: Use GUI::Window::set_main_widget<WidgetType>() in clients
Diffstat (limited to 'Games/Minesweeper/main.cpp')
-rw-r--r-- | Games/Minesweeper/main.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Games/Minesweeper/main.cpp b/Games/Minesweeper/main.cpp index fa33033a31..a1cc2c3c45 100644 --- a/Games/Minesweeper/main.cpp +++ b/Games/Minesweeper/main.cpp @@ -57,12 +57,11 @@ int main(int argc, char** argv) window->set_title("Minesweeper"); window->set_rect(100, 100, 139, 175); - auto widget = GUI::Widget::construct(); - window->set_main_widget(widget); - widget->set_layout<GUI::VerticalBoxLayout>(); - widget->layout()->set_spacing(0); + auto& widget = window->set_main_widget<GUI::Widget>(); + widget.set_layout<GUI::VerticalBoxLayout>(); + widget.layout()->set_spacing(0); - auto container = widget->add<GUI::Widget>(); + auto container = widget.add<GUI::Widget>(); container->set_fill_with_background_color(true); container->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed); container->set_preferred_size(0, 36); @@ -77,7 +76,7 @@ int main(int argc, char** argv) auto time_icon_label = container->add<GUI::Label>(); time_icon_label->set_icon(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/timer.png")); auto time_label = container->add<GUI::Label>(); - auto field = widget->add<Field>(*flag_label, *time_label, *face_button, [&](auto size) { + auto field = widget.add<Field>(*flag_label, *time_label, *face_button, [&](auto size) { size.set_height(size.height() + container->preferred_size().height()); window->resize(size); }); |