mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 19:35:08 +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
|
@ -105,8 +105,10 @@ void GItemView::context_menu_event(GContextMenuEvent& event)
|
|||
GModelIndex index;
|
||||
if (item_index != -1) {
|
||||
index = model()->index(item_index, m_model_column);
|
||||
selection().add(index);
|
||||
update();
|
||||
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