mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:47:34 +00:00
GameOfLife: Ensure BoardWidget can always contain the board
Previously, when there were more rows or columns than the BoardWidget could contain, nothing was displayed. The BoardWidget minimum size is now set whenever the number of rows or columns changes.
This commit is contained in:
parent
871f5ba431
commit
9a6927c575
2 changed files with 2 additions and 0 deletions
|
@ -52,6 +52,7 @@ void BoardWidget::resize_board(size_t rows, size_t columns)
|
|||
return;
|
||||
m_board->resize(rows, columns);
|
||||
m_last_cell_toggled = { rows, columns };
|
||||
set_min_size(columns, rows);
|
||||
}
|
||||
|
||||
void BoardWidget::set_running_timer_interval(int interval)
|
||||
|
|
|
@ -63,6 +63,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
board_widget_container.set_layout<GUI::VerticalBoxLayout>(GUI::Margins {}, 0);
|
||||
auto board_widget = TRY(board_widget_container.try_add<BoardWidget>(board_rows, board_columns));
|
||||
board_widget->randomize_cells();
|
||||
board_widget->set_min_size(board_columns, board_rows);
|
||||
|
||||
auto& statusbar = *main_widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar");
|
||||
statusbar.set_text(click_tip);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue