1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:27:34 +00:00

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

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)