diff options
Diffstat (limited to 'Userland/Libraries/LibGUI/Label.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/Label.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Userland/Libraries/LibGUI/Label.cpp b/Userland/Libraries/LibGUI/Label.cpp index d41237803a..17045c5e04 100644 --- a/Userland/Libraries/LibGUI/Label.cpp +++ b/Userland/Libraries/LibGUI/Label.cpp @@ -34,11 +34,12 @@ Label::Label(String text) REGISTER_STRING_PROPERTY("icon", icon, set_icon_from_path); } -void Label::set_autosize(bool autosize) +void Label::set_autosize(bool autosize, size_t padding) { - if (m_autosize == autosize) + if (m_autosize == autosize && m_autosize_padding == padding) return; m_autosize = autosize; + m_autosize_padding = padding; if (m_autosize) size_to_fit(); } @@ -108,7 +109,7 @@ void Label::paint_event(PaintEvent& event) void Label::size_to_fit() { - set_fixed_width(font().width(m_text)); + set_fixed_width(font().width(m_text) + m_autosize_padding * 2); } int Label::preferred_height() const |