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

[REG 6.5.1-6.5.2] Automatic conversion JS Array -> QByteArray is broken

    XMLWordPrintable

Details

    • All
    • 9599f4c55 (dev), 5dc4a90e3 (6.5), 5dd59eb4a (6.6)

    Description

      Since Qt 6.5.2 automatic conversion from JS Array to QByteArray is broken.

      Sample code:
      QML

      import QtQuick
      import QtQuick.Controls
      
      Window {
          width: 640
          height: 480
          visible: true
      
          function testArray(array) {
              console.log('JS array: ' + array)
              test.byteArrayTest(array)
          }
      
          Component.onCompleted: {
              testArray([1, 2, 3])
              testArray(Array.from('456'))
          }
      }
      

      C++

      #pragma once
      #include <QObject>
      #include <QDebug>
      
      class Test : public QObject
      {
          Q_OBJECT
      
      public:
          Q_INVOKABLE void byteArrayTest(const QByteArray &ba)
          {
              qDebug() << "QByteArray: " << ba;
          }
      };
      

      See full example untitled.zip
      To reproduce the problem just compare console output when build with Qt 6.5.2 and Qt 6.5.1 (or any version prior)

      Attachments

        1. untitled.zip
          3 kB
          Vladimir Belyavsky

        Issue Links

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

          Activity

            People

              ulherman Ulf Hermann
              studiosus Vladimir Belyavsky
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes