mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-03-23 13:57:04 +00:00
LibGUI: Resize Label on font changes
And set fixed preferred heights when autosizing.
This commit is contained in:
committed by
Andreas Kling
parent
5294ef918e
commit
cfac3be0b3
@@ -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
|
||||
|
||||
@@ -49,6 +49,7 @@ protected:
|
||||
explicit Label(DeprecatedString text = {});
|
||||
|
||||
virtual void paint_event(PaintEvent&) override;
|
||||
virtual void did_change_font() override;
|
||||
virtual void did_change_text() { }
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user