mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:07:45 +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
1 changed files with 6 additions and 1 deletions
|
@ -63,11 +63,16 @@ public:
|
||||||
}
|
}
|
||||||
void set_subtitle(String text)
|
void set_subtitle(String text)
|
||||||
{
|
{
|
||||||
|
if (text.is_empty()) {
|
||||||
|
if (m_subtitle)
|
||||||
|
m_subtitle->remove_from_parent();
|
||||||
|
m_subtitle = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!m_subtitle) {
|
if (!m_subtitle) {
|
||||||
m_subtitle = m_label_container->add<GUI::Label>();
|
m_subtitle = m_label_container->add<GUI::Label>();
|
||||||
m_subtitle->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
m_subtitle->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_subtitle->set_text(move(text));
|
m_subtitle->set_text(move(text));
|
||||||
}
|
}
|
||||||
void set_is_highlighted(bool value)
|
void set_is_highlighted(bool value)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue