Using "model/metadata.h" for file and JSON object naming as well. Using all upper case for naming static meta data constants and functions.

This commit is contained in:
2025-12-29 10:35:00 +01:00
parent 0c3d711513
commit 3610aa3841
4 changed files with 24 additions and 12 deletions

View File

@ -26,7 +26,8 @@ QList<QHash<int, QVariant>> JsonParser::toItemValuesList(const QByteArray& jsonD
QHash<int, QVariant> JsonParser::jsonObjectToItemValues(const QJsonObject& itemJsonObject) {
QHash<int, QVariant> values;
// TODO make this more generic (by reading from model meta data)
// TODO iterate over "public & editable" roles (the ones that should occur in JSON file)
// & use a (static) function to retrieve it (i. e. getRoleValue(int role))
values[NameRole] = itemJsonObject[ROLE_NAMES.value(NameRole)].toString();
values[DescriptionRole] = itemJsonObject[ROLE_NAMES.value(DescriptionRole)].toString();
values[InfoRole] = itemJsonObject[ROLE_NAMES.value(InfoRole)].toString();