error no match for ‘operator’ operand types are ‘QJsonValue’ and ‘const char 5’ 182 infoName = objNametoString; ^
This error occurs because the QJsonValue class does not have an overloaded operator[] that takes a const char array as an argument. Instead, you need to use the QJsonObject class to access the values of a JSON object.
You can modify your code to use QJsonObject as follows:
QJsonObject obj = json.array()[i].toObject();
info.Name = obj["Name"].toString();
Here, we first convert the QJsonValue to a QJsonObject using the toObject() method, and then access the value of the "Name" key using the [] operator
原文地址: http://www.cveoy.top/t/topic/dHRf 著作权归作者所有。请勿转载和采集!