Spreadsheet: Delete key doesn't clear contents in selected cells

Fixes #15023. On macOS a different shortcut is defined for the 'Delete' key
This commit is contained in:
wmayer
2024-07-23 14:55:39 +02:00
committed by Chris Hennes
parent 88ee1d6df3
commit 703c349ade

View File

@@ -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();
}