在我的代码的这一部分,我想返回我的QStringList的大小
QStringList Attribute;
int tableSize = 0;
QString string= reply->readAll();
QRegExp expretion("[{}]");
Attribute = string.split(expretion);
tableSize = Attribute.size();
qDebug()<<tableSize;
qDebug()<<tableSize;
这将返回两个值(1和7)
字符串
的值[
{
"idInstallation": 10,
"tstId": 1,
"knockPerTest": 10,
"description": "aaaaaaaaaaaaaaaaaaaa",
"state": "1",
"dateCreation": "2019-07-09T12:46:00",
"dateStart": "2019-07-09T12:46:00",
"datePause": "2019-07-09T12:46:00",
"dateStop": "2019-07-09T12:46:00"
},
{
"idInstallation": 10,
"tstId": 2,
"knockPerTest": 20,
"description": "bbbbbbbbbbbbbbbbbbb",
"state": "1",
"dateCreation": "2019-07-09T12:46:00",
"dateStart": "2019-07-09T12:46:00",
"datePause": "2019-07-09T12:46:00",
"dateStop": "2019-07-09T12:46:00"
},
{
"idInstallation": 10,
"tstId": 3,
"knockPerTest": 30,
"description": "ccccccccccccccccccccc",
"state": "1",
"dateCreation": "2019-07-09T12:46:00",
"dateStart": "2019-07-09T12:46:00",
"datePause": "2019-07-09T12:46:00",
"dateStop": "2019-07-09T12:46:00"
}
]
我使用 split 的目标是分离我得到的jason记录。 例如
Attribute = json.split(expretion);
我找不到错误
当我打印到控制台时,它将返回以下值: