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

LibGUI: Add ComboBox::selected_index()

This returns the currently selected index. It was a bit strange that
we had set_selected_index() but not a way to read it back. :^)
This commit is contained in:
Andreas Kling 2020-08-21 20:01:45 +02:00
parent 50076997f4
commit 8055813ecf
2 changed files with 6 additions and 0 deletions

View file

@ -163,6 +163,11 @@ void ComboBox::set_selected_index(size_t index)
this->m_list_view->selection().set(model_index);
}
size_t ComboBox::selected_index() const
{
return m_list_view->selection().first().row();
}
void ComboBox::select_all()
{
m_editor->select_all();