diff options
-rw-r--r-- | Userland/Libraries/LibGUI/ComboBox.cpp | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/ComboBox.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/ComboBox.cpp b/Userland/Libraries/LibGUI/ComboBox.cpp index feefd6521a..b9419ba000 100644 --- a/Userland/Libraries/LibGUI/ComboBox.cpp +++ b/Userland/Libraries/LibGUI/ComboBox.cpp @@ -200,6 +200,13 @@ void ComboBox::set_model(NonnullRefPtr<Model> model) m_list_view->set_model(move(model)); } +void ComboBox::clear_selection() +{ + m_selected_index.clear(); + m_editor->clear_selection(); + m_editor->clear(); +} + void ComboBox::set_selected_index(size_t index, AllowCallback allow_callback) { if (!m_list_view->model()) diff --git a/Userland/Libraries/LibGUI/ComboBox.h b/Userland/Libraries/LibGUI/ComboBox.h index 615d2f0534..598b080940 100644 --- a/Userland/Libraries/LibGUI/ComboBox.h +++ b/Userland/Libraries/LibGUI/ComboBox.h @@ -33,6 +33,7 @@ public: size_t selected_index() const; void set_selected_index(size_t index, AllowCallback = AllowCallback::Yes); + void clear_selection(); bool only_allow_values_from_model() const { return m_only_allow_values_from_model; } void set_only_allow_values_from_model(bool); |