mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 02:24:59 +00:00
LibGUI: Tweak selection modification behavior on context menu event
Before bringing up the context menu, clicking... - ...on an already selected item leaves selection alone - ...on an unselected item makes it the only selected item - ...outside any item clears the selection
This commit is contained in:
parent
f1c4b65089
commit
f360858836
2 changed files with 10 additions and 8 deletions
|
@ -517,12 +517,12 @@ void GTableView::context_menu_event(GContextMenuEvent& event)
|
|||
}
|
||||
|
||||
auto index = index_at_event_position(event.position());
|
||||
if (!index.is_valid())
|
||||
return;
|
||||
dbgprintf("context menu requested for index (%d,%d) '%s'\n", index.row(), index.column(), model()->data(index).to_string().characters());
|
||||
|
||||
selection().set(index);
|
||||
update();
|
||||
if (index.is_valid()) {
|
||||
if (!selection().contains(index))
|
||||
selection().set(index);
|
||||
} else {
|
||||
selection().clear();
|
||||
}
|
||||
if (on_context_menu_request)
|
||||
on_context_menu_request(index, event);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue