1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 10:44:57 +00:00

LibGUI: Allow rollback of model editing delegate input

In the StringModelEditingDelegate convenience class, we simply hook up
the escape key to editor rollback. This means you can cancel an ongoing
cell edit by pressing escape. :^)
This commit is contained in:
Andreas Kling 2020-08-28 20:50:12 +02:00
parent c43f0f012d
commit 12dfeb9845
2 changed files with 13 additions and 0 deletions

View file

@ -147,6 +147,10 @@ void AbstractView::begin_editing(const ModelIndex& index)
model()->set_data(m_edit_index, m_editing_delegate->value());
stop_editing();
};
m_editing_delegate->on_rollback = [this] {
ASSERT(model());
stop_editing();
};
}
void AbstractView::stop_editing()