diff options
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/FontEditor/FontEditor.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/ComboBox.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/ComboBox.h | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Applications/FontEditor/FontEditor.cpp b/Userland/Applications/FontEditor/FontEditor.cpp index 9f56711510..1431df911d 100644 --- a/Userland/Applications/FontEditor/FontEditor.cpp +++ b/Userland/Applications/FontEditor/FontEditor.cpp @@ -521,7 +521,7 @@ void FontEditorWidget::initialize(String const& path, RefPtr<Gfx::BitmapFont>&& int i = 0; for (auto& it : Gfx::font_weight_names) { if (it.style == m_edited_font->weight()) { - m_weight_combobox->set_selected_index(i); + m_weight_combobox->set_selected_index(i, GUI::AllowCallback::No); break; } i++; @@ -529,7 +529,7 @@ void FontEditorWidget::initialize(String const& path, RefPtr<Gfx::BitmapFont>&& i = 0; for (auto& it : Gfx::font_slope_names) { if (it.style == m_edited_font->slope()) { - m_slope_combobox->set_selected_index(i); + m_slope_combobox->set_selected_index(i, GUI::AllowCallback::No); break; } i++; diff --git a/Userland/Libraries/LibGUI/ComboBox.cpp b/Userland/Libraries/LibGUI/ComboBox.cpp index aae3474a07..ec86eeec6c 100644 --- a/Userland/Libraries/LibGUI/ComboBox.cpp +++ b/Userland/Libraries/LibGUI/ComboBox.cpp @@ -201,14 +201,14 @@ void ComboBox::set_model(NonnullRefPtr<Model> model) m_list_view->set_model(move(model)); } -void ComboBox::set_selected_index(size_t index) +void ComboBox::set_selected_index(size_t index, AllowCallback allow_callback) { 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) + if (previous_index != selected_index() && on_change && allow_callback == AllowCallback::Yes) on_change(m_editor->text(), m_list_view->cursor_index()); } diff --git a/Userland/Libraries/LibGUI/ComboBox.h b/Userland/Libraries/LibGUI/ComboBox.h index a772718838..4db98b30e9 100644 --- a/Userland/Libraries/LibGUI/ComboBox.h +++ b/Userland/Libraries/LibGUI/ComboBox.h @@ -32,7 +32,7 @@ public: void set_model(NonnullRefPtr<Model>); size_t selected_index() const; - void set_selected_index(size_t index); + void set_selected_index(size_t index, AllowCallback = AllowCallback::Yes); bool only_allow_values_from_model() const { return m_only_allow_values_from_model; } void set_only_allow_values_from_model(bool); |