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

REG: Copy values inside QJsonObject fails

    XMLWordPrintable

Details

    • ddc7b3c1565b5f7100df4d13e5501f76db2730ee (qt/qtbase/5.15)

    Description

      Copying values in QJsonObjects sometimes doesn't work:

      Working example:

          QJsonObject obj;
          obj["prop1"] = "TEST";
          qDebug() << "OBJ 1:" << obj << obj.value("prop1");
          obj["prop2"] = obj.value("prop1");
          qDebug() << "OBJ 2:" << obj;

       

      Result:

      OBJ 1: QJsonObject({"prop1":"TEST"}) QJsonValue(string, "TEST")

      OBJ 2: QJsonObject({"prop1":"TEST","prop2":"TEST"})

      Small modifications will break it:

          QJsonObject obj;
          obj["value"] = "TEST";
          qDebug() << "OBJ 1:" << obj << obj.value("value");
          obj["prop2"] = obj.value("value");
          qDebug() << "OBJ 2:" << obj;
      

      Result:

      OBJ 1: QJsonObject({"value":"TEST"}) QJsonValue(string, "TEST")

      OBJ 2: QJsonObject({"prop2":"","value":"TEST"})

       

       

      Attachments

        Issue Links

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

          Activity

            People

              thiago Thiago Macieira
              zerocom Stefan Sommerfeld
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes