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

QJsonArray::fromVariantList produce garbage

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.15.0
    • Core: Other
    • None
    • 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

              thiago Thiago Macieira
              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