mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
Assistant: Don't add a subtitle label widget if we don't need it
This commit is contained in:
parent
6f0e8f823b
commit
6c630437e9
Notes:
sideshowbarker
2024-07-18 11:13:01 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/6c630437e96
|
@ -63,11 +63,16 @@ public:
|
|||
}
|
||||
void set_subtitle(String text)
|
||||
{
|
||||
if (text.is_empty()) {
|
||||
if (m_subtitle)
|
||||
m_subtitle->remove_from_parent();
|
||||
m_subtitle = nullptr;
|
||||
return;
|
||||
}
|
||||
if (!m_subtitle) {
|
||||
m_subtitle = m_label_container->add<GUI::Label>();
|
||||
m_subtitle->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
}
|
||||
|
||||
m_subtitle->set_text(move(text));
|
||||
}
|
||||
void set_is_highlighted(bool value)
|
||||
|
|
Loading…
Reference in a new issue