Skip to content

Commit

Permalink
Assistant: Don't add a subtitle label widget if we don't need it
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Jun 30, 2021
1 parent 6f0e8f8 commit 6c63043
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Userland/Applications/Assistant/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,16 @@ class ResultRow final : public GUI::Widget {
}
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)
Expand Down

0 comments on commit 6c63043

Please sign in to comment.