Assistant: Don't add a subtitle label widget if we don't need it

This commit is contained in:
Andreas Kling 2021-06-30 11:44:34 +02:00
parent 6f0e8f823b
commit 6c630437e9
Notes: sideshowbarker 2024-07-18 11:13:01 +09:00

View file

@ -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)