From f392efb54f6951c5eabb147674dda3d2b7bc14e2 Mon Sep 17 00:00:00 2001 From: Bent Witthold Date: Mon, 2 Mar 2026 16:25:01 +0100 Subject: [PATCH] Added static GET_HEADER_FOR_COLUMN(const int column) function. --- model/metadata.h | 6 ++++++ model/tablemodel.cpp | 1 + 2 files changed, 7 insertions(+) diff --git a/model/metadata.h b/model/metadata.h index 04bd561..3ee11f5 100644 --- a/model/metadata.h +++ b/model/metadata.h @@ -86,4 +86,10 @@ static QList GET_HEADER_NAMES() { return result; } +static QString GET_HEADER_FOR_COLUMN(const int column) { + const UserRoles role = GET_ROLE_FOR_COLUMN(column); + const QString headerName = ROLE_NAMES.value(role); + return headerName; +} + #endif // METADATA_H diff --git a/model/tablemodel.cpp b/model/tablemodel.cpp index 3e18448..cc703ef 100644 --- a/model/tablemodel.cpp +++ b/model/tablemodel.cpp @@ -304,6 +304,7 @@ QMap TableModel::onlyChangedValues(const QModelIndex& index, // TODO check if role is a editable role? if (oldValue != newValue) { bool emptyValueIsEqualToZero = isEmptyValueEqualToZero(role); + // REFACTOR the next if statement is too complex if (emptyValueIsEqualToZero && oldValue == QVariant() && newValue == 0) { qDebug() << "oldValue:" << oldValue << "& newValue:" << newValue << "mean the same. Ignoring...";