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:
parent
5294ef918e
commit
cfac3be0b3
2 changed files with 8 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue