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:
Martin Kleusberg
2017-06-28 16:56:26 +02:00
parent 803a1fa5cb
commit df8219de09

View File

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