diff --git a/src/Mod/Spreadsheet/Gui/SheetTableView.cpp b/src/Mod/Spreadsheet/Gui/SheetTableView.cpp index d9d2136380..fb57a8f85c 100644 --- a/src/Mod/Spreadsheet/Gui/SheetTableView.cpp +++ b/src/Mod/Spreadsheet/Gui/SheetTableView.cpp @@ -582,16 +582,15 @@ bool SheetTableView::event(QEvent* event) case Qt::Key_Backtab: finishEditWithMove(kevent->key(), kevent->modifiers(), true); return true; - // Also handle the delete key here: - case Qt::Key_Delete: - deleteSelection(); - return true; case Qt::Key_Escape: sheet->setCopyOrCutRanges({}); return true; default: break; } + if (kevent->matches(QKeySequence::Delete) || kevent->matches(QKeySequence::Backspace)) { + deleteSelection(); + } if (kevent->matches(QKeySequence::Cut)) { cutSelection(); return true; @@ -614,8 +613,6 @@ bool SheetTableView::event(QEvent* event) [[fallthrough]]; case Qt::Key_Enter: [[fallthrough]]; - case Qt::Key_Delete: - [[fallthrough]]; case Qt::Key_Home: [[fallthrough]]; case Qt::Key_End: @@ -642,6 +639,9 @@ bool SheetTableView::event(QEvent* event) } } + if (kevent->matches(QKeySequence::Delete) || kevent->matches(QKeySequence::Backspace)) { + kevent->accept(); + } if (kevent->matches(QKeySequence::Cut)) { kevent->accept(); }