在 Qt 的 JSON 实现中,在QJsonObject类中,运算符有两种实现(文档here):
QJsonValue QJsonObject::operator[](const QString & key) const;
QJsonValueRef QJsonObject::operator[](const QString & key);
Run Code Online (Sandbox Code Playgroud)
首先,与返回QJsonValueRef相比,返回有QJsonValue什么优势?其次,该值如果我只是说的一样会被退回root['time'],其中root的一个QJsonObject?