mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 01:59:31 +00:00
LibGUI: Actually update the selection in ComboBox::set_selected_index
Previously we would not set m_selected_index or the editor's text value when calling set_selected_index.
This commit is contained in:
parent
695dfabc2e
commit
82f537b847
Notes:
sideshowbarker
2024-07-17 10:07:03 +09:00
Author: https://github.com/networkException
Commit: 82f537b847
Pull-request: https://github.com/SerenityOS/serenity/pull/14305
Reviewed-by: https://github.com/linusg ✅
1 changed files with 3 additions and 1 deletions
|
@ -213,7 +213,9 @@ void ComboBox::set_selected_index(size_t index, AllowCallback allow_callback)
|
|||
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);
|
||||
auto model_index = m_list_view->model()->index(index, 0);
|
||||
m_list_view->set_cursor(model_index, AbstractView::SelectionUpdate::Set);
|
||||
selection_updated(model_index);
|
||||
if (previous_index != selected_index() && on_change && allow_callback == AllowCallback::Yes)
|
||||
on_change(m_editor->text(), m_list_view->cursor_index());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue