summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/ComboBox.cpp
diff options
context:
space:
mode:
authornetworkException <git@nwex.de>2022-06-16 21:52:08 +0200
committerLinus Groh <mail@linusgroh.de>2022-06-17 19:46:30 +0100
commit82f537b847aea9f98a2d79de55a4409b7107d3ef (patch)
treef4c7c0960e8ba44d0eaf8d9662a9e91bf6d2fb56 /Userland/Libraries/LibGUI/ComboBox.cpp
parent695dfabc2ec2648931dba5c4d1c457aea728c43d (diff)
downloadserenity-82f537b847aea9f98a2d79de55a4409b7107d3ef.zip
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.
Diffstat (limited to 'Userland/Libraries/LibGUI/ComboBox.cpp')
-rw-r--r--Userland/Libraries/LibGUI/ComboBox.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/ComboBox.cpp b/Userland/Libraries/LibGUI/ComboBox.cpp
index b9419ba000..ef4ff469ec 100644
--- a/Userland/Libraries/LibGUI/ComboBox.cpp
+++ b/Userland/Libraries/LibGUI/ComboBox.cpp
@@ -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());
}