mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:48:14 +00:00
LibGUI: Make ComboBox report on_change for set_selected_index
As navigate and navigate_relative also do this, it seems reasonable to have it here.
This commit is contained in:
parent
642915215f
commit
1349b8b10f
1 changed files with 3 additions and 0 deletions
|
@ -193,8 +193,11 @@ void ComboBox::set_selected_index(size_t index)
|
|||
{
|
||||
if (!m_list_view->model())
|
||||
return;
|
||||
size_t previous_index = selected_index();
|
||||
TemporaryChange change(m_updating_model, true);
|
||||
m_list_view->set_cursor(m_list_view->model()->index(index, 0), AbstractView::SelectionUpdate::Set);
|
||||
if (previous_index != selected_index() && on_change)
|
||||
on_change(m_editor->text(), m_list_view->cursor_index());
|
||||
}
|
||||
|
||||
size_t ComboBox::selected_index() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue