Use the column type affinity for the default text alignment

In this way the entire column has the same alignment and gives a hint of
the column datatype. Note that if the DB has data incoherent with the
affinity, it will not be reflected in the text alignment.

See issue #2032
This commit is contained in:
mgrojo
2019-11-15 21:21:06 +01:00
parent d567f3856f
commit 914292f299

View File

@@ -409,8 +409,7 @@ QVariant SqliteTableModel::data(const QModelIndex &index, int role) const
QVariant condFormat = getMatchingCondFormat(row, column, data, role);
if (condFormat.isValid())
return condFormat;
bool isNumber;
data.toDouble(&isNumber);
bool isNumber = m_vDataTypes.at(column) == SQLITE_INTEGER || m_vDataTypes.at(column) == SQLITE_FLOAT;
return static_cast<int>((isNumber ? Qt::AlignRight : Qt::AlignLeft) | Qt::AlignVCenter);
} else if(role == Qt::DecorationRole) {
if(!row_available)