mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:27:45 +00:00
Spreadsheet: Keep value when clicking out of a cell
This commit is contained in:
parent
73b9cfac1b
commit
6219c3ec3c
2 changed files with 7 additions and 0 deletions
|
@ -186,6 +186,9 @@ SpreadsheetView::SpreadsheetView(Sheet& sheet)
|
||||||
m_table_view->stop_editing();
|
m_table_view->stop_editing();
|
||||||
m_table_view->dispatch_event(event);
|
m_table_view->dispatch_event(event);
|
||||||
};
|
};
|
||||||
|
delegate->on_cell_focusout = [this](auto& index, auto& value) {
|
||||||
|
m_table_view->model()->set_data(index, value);
|
||||||
|
};
|
||||||
return delegate;
|
return delegate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -124,10 +124,14 @@ private:
|
||||||
commit();
|
commit();
|
||||||
on_cursor_key_pressed(event);
|
on_cursor_key_pressed(event);
|
||||||
};
|
};
|
||||||
|
textbox->on_focusout = [this] {
|
||||||
|
on_cell_focusout(index(), value());
|
||||||
|
};
|
||||||
return textbox;
|
return textbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
Function<void(GUI::KeyEvent&)> on_cursor_key_pressed;
|
Function<void(GUI::KeyEvent&)> on_cursor_key_pressed;
|
||||||
|
Function<void(const GUI::ModelIndex&, const GUI::Variant&)> on_cell_focusout;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_has_set_initial_value { false };
|
bool m_has_set_initial_value { false };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue