1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-08 20:07:35 +00:00

GTableView: Double-click should only activate/edit valid indices.

This commit is contained in:
Andreas Kling 2019-04-25 22:55:44 +02:00
parent e2e2c78332
commit 8a3d00ac02

View file

@ -318,11 +318,14 @@ void GTableView::doubleclick_event(GMouseEvent& event)
{ {
if (!model()) if (!model())
return; return;
auto& model = *this->model();
if (event.button() == GMouseButton::Left) { if (event.button() == GMouseButton::Left) {
mousedown_event(event); mousedown_event(event);
if (model.selected_index().is_valid()) {
if (is_editable()) if (is_editable())
begin_editing(model()->selected_index()); begin_editing(model.selected_index());
else else
model()->activate(model()->selected_index()); model.activate(model.selected_index());
}
} }
} }