mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 00:35:06 +00:00
LibGUI: Add AbstractView "edit triggers" to improve editing control
This API allows the embedder of a view to decide which actions upon the view will begin editing the current item. To maintain the old behavior, we will begin editing when an item is either double-clicked, or when the "edit key" (return) is pressed.
This commit is contained in:
parent
383ee279ee
commit
f3e4b62be9
4 changed files with 27 additions and 12 deletions
|
@ -165,7 +165,10 @@ void TableView::keydown_event(KeyEvent& event)
|
|||
if (!model())
|
||||
return;
|
||||
if (event.key() == KeyCode::Key_Return) {
|
||||
activate_or_edit_selected();
|
||||
if (is_editable() && edit_triggers() & EditTrigger::EditKeyPressed)
|
||||
begin_editing(cursor_index());
|
||||
else
|
||||
activate(cursor_index());
|
||||
return;
|
||||
}
|
||||
return AbstractTableView::keydown_event(event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue