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
Notes: sideshowbarker 2024-07-19 14:35:22 +09:00

View file

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