Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-55579

QJsonObject[] not work correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.7.0
    • Core: Other, Documentation
    • None

      code example:

      QJsonObject testObject;
      qInfo() << testObject["keyname"].isUndefined() << testObject["keyname"].type();
      

      This is code print "false 0".
      where "false" is result of testObject["keyname"].isUndefined()
      "0" is result of testObject["keyname"].type() and equal QJsonValue::Null

      In documention printed:

      QJsonValue QJsonObject::operator[](const QString &key) const
      Returns a QJsonValue representing the value for the key key.
      This does the same as value().
      The returned QJsonValue is QJsonValue::Undefined if the key does not exist.

      But returned value have type QJsonValue::Null, not QJsonValue::Undefined.

      1. Š’ehavior does not comply with the documentation;
      2. In some case QJsonValue::Null is correct value of object property.

      Sorry for my english

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            thiago Thiago Macieira
            pyroman010 Vladimir Martemianov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes