-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsonparseclass.cpp
31 lines (28 loc) · 917 Bytes
/
jsonparseclass.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "jsonparseclass.h"
JsonParseClass::JsonParseClass()
{
}
InfoClass JsonParseClass::setTestData(QVariantMap qMap, QStringList keyList)
{
InfoClass res;
for (int j = 0; j < keyList.size(); j++) {
QString key = keyList.at(j);
for (int k = 0; k < keysJson.size(); k++) {
if(key == keysJson[k]){
switch (k) {
case 0: res.setNumber(qMap[key.toLocal8Bit()].toInt());
break;
case 1: res.setX(qMap[key.toLocal8Bit()].toInt());
break;
case 2: res.setY(qMap[key.toLocal8Bit()].toInt());
break;
case 3: res.setWidth(qMap[key.toLocal8Bit()].toInt());
break;
case 4: res.setHeight(qMap[key.toLocal8Bit()].toInt());
break;
}
}
}
}
return res;
}