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.
This commit is contained in:
Martin Kleusberg
2018-08-12 14:07:53 +02:00
parent b219edbbfb
commit b717140fe9

View File

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