TreeFrogFramework  1.18
tjsonutil.h
Go to the documentation of this file.
1 #ifndef TJSONUTIL_H
2 #define TJSONUTIL_H
3 
4 #include <QJsonArray>
5 #include <QJsonObject>
6 #include <QList>
7 #include <QVariantMap>
8 
9 
10 template <class T>
11 inline QJsonArray tfModelListToJsonArray(const QList<T> &models)
12 {
13  QJsonArray array;
14 
15  for (auto &mdl : models) {
16  array.append(QJsonValue(QJsonObject::fromVariantMap(mdl.toVariantMap())));
17  }
18  return array;
19 }
20 
21 #endif // TJSONUTIL_H
QJsonArray tfModelListToJsonArray(const QList< T > &models)
Definition: tjsonutil.h:11