mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-19 18:40:13 -06:00
In Edit Index dialog don't remove expression columns by accident
Don't allow removing expression columns by double clicking as this it too error-prone. Instead require a button click for removal and only start editing the expression when double clicking. See issue #1012.
This commit is contained in:
@@ -195,6 +195,15 @@ void EditIndexDialog::removeFromIndex(const QModelIndex& idx)
|
||||
if(row == -1)
|
||||
return;
|
||||
|
||||
// If this is an expression column and the action was triggered by a double click event instead of a button click,
|
||||
// we won't remove the expression column because it's too likely that this was only done by accident by the user.
|
||||
// Instead just open the expression column for editing.
|
||||
if(index.column(row)->expression() && sender() != ui->buttonFromIndex)
|
||||
{
|
||||
ui->tableIndexColumns->editItem(ui->tableIndexColumns->item(row, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove column from index
|
||||
index.removeColumn(ui->tableIndexColumns->item(row, 0)->text());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user