Using the typedef ModelItemValues for "QHash<int, QVariant>".

This commit is contained in:
2026-01-04 17:48:27 +01:00
parent 2702b9c835
commit 3e6273cb7d
15 changed files with 60 additions and 49 deletions

View File

@ -8,20 +8,22 @@ class QString;
class QByteArray;
class QJsonArray;
typedef QHash<int, QVariant> ModelItemValues;
using namespace std;
class JsonParser {
public:
static QList<QHash<int, QVariant>> toItemValuesList(const QByteArray& jsonData,
const QString& objectName = "");
static QByteArray itemValuesListToJson(const QList<QHash<int, QVariant>>& itemValuesList,
static QList<ModelItemValues> toItemValuesList(const QByteArray& jsonData,
const QString& objectName = "");
static QByteArray itemValuesListToJson(const QList<ModelItemValues>& itemValuesList,
const QString& objectName = "");
private:
explicit JsonParser();
static QJsonArray extractItemArray(const QByteArray& jsonData, const QString& objectName);
static QHash<int, QVariant> jsonObjectToItemValues(const QJsonObject& itemJsonObject);
static ModelItemValues jsonObjectToItemValues(const QJsonObject& itemJsonObject);
static pair<int, QVariant> getKeyValuePair(const QJsonObject& itemJsonObject, const int role);
};