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

QJsonArray::fromVariantList produce garbage

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Duplicate
    • Affects Version/s: 5.15.0
    • Fix Version/s: None
    • Component/s: Core: Other
    • Labels:
      None
    • Platform/s:
      All

      Description

          QByteArray helloWorld = "Hello World";
      
          QVariantList list;
          list << helloWorld;
      
          QJsonArray array = QJsonArray::fromVariantList(list);
          qDebug().noquote() << "Source" << helloWorld;
          qDebug().noquote() << "String" << array.first().toString();
          qDebug().noquote() << "ByteArray" << array.first().toVariant().toByteArray();
      

      Results:

      ./Test_5.14.2
      Source Hello World
      String Hello World
      ByteArray Hello World
      
      ./Test_5.15.0
      Source Hello World
      String SGVsbG8gV29ybGQ
      ByteArray SGVsbG8gV29ybGQ
      

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              thiago Thiago Macieira
              Reporter:
              ighor IGHOR
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes