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

QJsonArray::fromVariantList produce garbage

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.15.0
    • Core: Other
    • None
    • All

          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
      

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes