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
commit 12dfeb9845
Notes: sideshowbarker 2024-07-19 03:03:45 +09:00
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()