LibGUI: Stop editing in views when the view is hidden

This fixes an issue in FileManager where an editor opened in the table
view mode would remain open after switching to the icon mode.
This commit is contained in:
Andreas Kling 2020-09-24 21:14:14 +02:00
parent 53f3313cee
commit d8553a6406
Notes: sideshowbarker 2024-07-19 02:15:14 +09:00
2 changed files with 7 additions and 0 deletions

View file

@ -445,6 +445,12 @@ void AbstractView::set_edit_triggers(unsigned triggers)
m_edit_triggers = triggers;
}
void AbstractView::hide_event(HideEvent& event)
{
stop_editing();
ScrollableWidget::hide_event(event);
}
void AbstractView::keydown_event(KeyEvent& event)
{
if (event.key() == KeyCode::Key_F2) {

View file

@ -129,6 +129,7 @@ protected:
virtual void context_menu_event(ContextMenuEvent&) override;
virtual void drop_event(DropEvent&) override;
virtual void leave_event(Core::Event&) override;
virtual void hide_event(HideEvent&) override;
virtual void clear_selection();
virtual void set_selection(const ModelIndex&);