mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
GLayout: Add a simple spacer concept; dummy item that expands-to-fit.
A spacer can be inserted anywhere in a layout and will simply expand to fill the available space. This is useful for pushing widgets into place. :^)
This commit is contained in:
parent
bd5c79aff2
commit
bffaa5ece6
Notes:
sideshowbarker
2024-07-19 14:11:22 +09:00
Author: https://github.com/awesomekling
Commit: bffaa5ece6
4 changed files with 39 additions and 7 deletions
|
@ -13,7 +13,7 @@ GFilePicker::GFilePicker(const String& path, CObject* parent)
|
|||
set_rect(200, 200, 400, 300);
|
||||
set_main_widget(new GWidget);
|
||||
main_widget()->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||
main_widget()->layout()->set_margins({ 4, 0, 4, 0 });
|
||||
main_widget()->layout()->set_margins({ 4, 4, 4, 4 });
|
||||
main_widget()->layout()->set_spacing(4);
|
||||
main_widget()->set_fill_with_background_color(true);
|
||||
main_widget()->set_background_color(Color::LightGray);
|
||||
|
@ -42,6 +42,7 @@ GFilePicker::GFilePicker(const String& path, CObject* parent)
|
|||
button_container->set_preferred_size({ 0, 20 });
|
||||
button_container->set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
||||
button_container->layout()->set_spacing(4);
|
||||
button_container->layout()->add_spacer();
|
||||
|
||||
auto* cancel_button = new GButton(button_container);
|
||||
cancel_button->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue