1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

LibGUI: Add clear_selection helper for ComboBox

This patch adds a helper to ComboBox allowing it to clear the current
selection and show a blank editor.
This commit is contained in:
networkException 2022-06-16 20:17:44 +02:00 committed by Linus Groh
parent e9e1959d4c
commit 84780f3ed5
2 changed files with 8 additions and 0 deletions

View file

@ -200,6 +200,13 @@ void ComboBox::set_model(NonnullRefPtr<Model> model)
m_list_view->set_model(move(model));
}
void ComboBox::clear_selection()
{
m_selected_index.clear();
m_editor->clear_selection();
m_editor->clear();
}
void ComboBox::set_selected_index(size_t index, AllowCallback allow_callback)
{
if (!m_list_view->model())