From b717140fe9bffdbdb8291e89e746bbd98583aeb6 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Sun, 12 Aug 2018 14:07:53 +0200 Subject: [PATCH] Fix editing table with custom display formats set Since PR #1436 we allow configuration of the identifier quotes instead of always using backticks. But in the code for detecting a custom display format on a column the assumption still was that normal columns without a custom display format are always surrounded in backticks. The result of this was that even if there is only a single display format configured for a table, no field of no column can be edited anymore. This commit restores the original state which would only disable editing for the columns with a custom display format. --- src/sqlitetablemodel.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sqlitetablemodel.cpp b/src/sqlitetablemodel.cpp index 842030dc..48f3cc6d 100644 --- a/src/sqlitetablemodel.cpp +++ b/src/sqlitetablemodel.cpp @@ -412,9 +412,8 @@ Qt::ItemFlags SqliteTableModel::flags(const QModelIndex& index) const bool custom_display_format = false; if(m_vDisplayFormat.size()) { - // NOTE: This assumes that custom display formats never start and end with a backtick if(index.column() > 0) - custom_display_format = !(m_vDisplayFormat.at(index.column()-1).startsWith("`") && m_vDisplayFormat.at(index.column()-1).endsWith("`")); + custom_display_format = m_vDisplayFormat.at(index.column()-1) != sqlb::escapeIdentifier(headerData(index.column(), Qt::Horizontal).toString()); } if(!isBinary(index) && !custom_display_format)