From df8219de09c4d726b670d2742672f958beef6120 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Wed, 28 Jun 2017 16:56:26 +0200 Subject: [PATCH] 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. --- src/EditIndexDialog.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/EditIndexDialog.cpp b/src/EditIndexDialog.cpp index 1397c6b9..7e1a1514 100644 --- a/src/EditIndexDialog.cpp +++ b/src/EditIndexDialog.cpp @@ -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());