mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 03:08:13 +00:00
LibGUI: Explicitly fire a resize event when toggling Calendar mode
Calendar::toggle_mode function performed a call to Widget::resize with swapped width and height parameters as a quick way to trigger a resize_event (resize event is generated only when the new rect size is different from the old one, hence the swapped parameters). This method does not work when width and height are equal, such as in the DatePicker widget where width and height are fixed to 200x200. In such case, calls to Calendar::toggle_mode would not generate a resize event, leaving tiles uninitialized, therefore the widget was not able to properly paint the Month view. This commit replaces Widget::resize call with a manual triggering of the event.
This commit is contained in:
parent
9966feab4d
commit
bc9bba1d9b
1 changed files with 2 additions and 1 deletions
|
@ -80,7 +80,8 @@ void Calendar::toggle_mode()
|
|||
set_show_year(!m_show_year);
|
||||
set_show_month_and_year(!m_show_month_year);
|
||||
update_tiles(this->view_year(), this->view_month());
|
||||
this->resize(this->height(), this->width());
|
||||
ResizeEvent resize_evt(relative_rect().size());
|
||||
event(resize_evt);
|
||||
invalidate_layout();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue