diff options
author | Andreas Kling <kling@serenityos.org> | 2020-08-24 21:10:00 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-24 21:10:00 +0200 |
commit | 0f0b37d137207fa838d26045cf275d89d5a8af5e (patch) | |
tree | 656c4f9b1a4ec05c957475acef956fddb32eadbb /Libraries/LibGUI/AbstractView.cpp | |
parent | 032f567422a64812b0c134068c3b24396926478e (diff) | |
download | serenity-0f0b37d137207fa838d26045cf275d89d5a8af5e.zip |
LibGUI: Return focus to view when stopping editing
If the editing widget (as provided by the editing delegate) was focused
when editing stops, have the view take back focus.
Diffstat (limited to 'Libraries/LibGUI/AbstractView.cpp')
-rw-r--r-- | Libraries/LibGUI/AbstractView.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Libraries/LibGUI/AbstractView.cpp b/Libraries/LibGUI/AbstractView.cpp index a86e222fd0..5fc9425e3b 100644 --- a/Libraries/LibGUI/AbstractView.cpp +++ b/Libraries/LibGUI/AbstractView.cpp @@ -151,11 +151,15 @@ void AbstractView::begin_editing(const ModelIndex& index) void AbstractView::stop_editing() { + bool take_back_focus = false; m_edit_index = {}; if (m_edit_widget) { + take_back_focus = m_edit_widget->is_focused(); remove_child(*m_edit_widget); m_edit_widget = nullptr; } + if (take_back_focus) + set_focus(true); } void AbstractView::activate(const ModelIndex& index) |