1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:28:11 +00:00

LibGUI: Resize Label on font changes

And set fixed preferred heights when autosizing.
This commit is contained in:
thankyouverycool 2023-04-14 08:54:16 -04:00 committed by Andreas Kling
parent 5294ef918e
commit cfac3be0b3
2 changed files with 8 additions and 0 deletions

View file

@ -109,9 +109,16 @@ void Label::paint_event(PaintEvent& event)
}
}
void Label::did_change_font()
{
if (m_autosize)
size_to_fit();
}
void Label::size_to_fit()
{
set_fixed_width(text_calculated_preferred_width());
set_fixed_height(text_calculated_preferred_height());
}
int Label::text_calculated_preferred_width() const