mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-02-09 04:58:27 -06:00
Avoid multiple error messages when deleting cell values
When multiple cells are selected pressing the Delete key tries to set all of them to an empty string. In case of a unique constraint or similar constraints this throws an error. This commit copies the behaviour of the set to NULL menu action in that it aborts at the first error to avoid multiple error messages. See issue #2704.
This commit is contained in:
@@ -951,7 +951,10 @@ void ExtendedTableWidget::keyPressEvent(QKeyEvent* event)
|
||||
} else {
|
||||
// When pressing Delete only set the value to empty string
|
||||
for(const QModelIndex& index : selectedIndexes())
|
||||
model()->setData(index, "");
|
||||
{
|
||||
if(!model()->setData(index, ""))
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(event->modifiers().testFlag(Qt::ControlModifier) && (event->key() == Qt::Key_PageUp || event->key() == Qt::Key_PageDown)) {
|
||||
|
||||
Reference in New Issue
Block a user