summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorkleines Filmröllchen <malu.bertsch@gmail.com>2021-09-28 17:21:43 +0200
committerAndreas Kling <kling@serenityos.org>2021-11-03 10:48:25 +0100
commit1349b8b10ff8faa9c5490d967e6b5b0ed8f43858 (patch)
tree398ab4fb689b0f5d17aa6bb2a793fa9fe4627494 /Userland/Libraries
parent642915215f6f87f88e37c0a2621f8ddba73beee8 (diff)
downloadserenity-1349b8b10ff8faa9c5490d967e6b5b0ed8f43858.zip
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.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibGUI/ComboBox.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/ComboBox.cpp b/Userland/Libraries/LibGUI/ComboBox.cpp
index 5eee3508ab..e84846b523 100644
--- a/Userland/Libraries/LibGUI/ComboBox.cpp
+++ b/Userland/Libraries/LibGUI/ComboBox.cpp
@@ -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