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

[Reg 6.3 -> 6.4] Cannot assign QVariantList to lists of other value types anymore in QML

    XMLWordPrintable

Details

    • 32a9015c8 (dev), e7bfadb78 (6.5), 362c3f6e9 (6.4)

    Description

      Consider:

      #include <qqml.h>
      class CppObj : public QObject
      {
          Q_OBJECT
          QML_ELEMENT
          QML_SINGLETON
          Q_PROPERTY(QVariantList varList READ varList NOTIFY varListChanged)
      public:
          explicit CppObj(QObject *parent = nullptr) : QObject(parent) {}
          QVariantList varList() const { return {1.1, 2.2, 3.3}; }
      signals:
          void varListChanged();
      };
      
      import QtQuick
      import QtQuick.Shapes
      import MyTest
      Window {
          width: 640
          height: 480
          visible: true
          ShapePath {
              id: path
              dashPattern: CppObj.varList
          }
          Component.onCompleted: {
              console.log("Source list:", CppObj.varList)
              console.log("Target list:", path.dashPattern)
          }
      }
      

      This works in 6.3 and earlier, but breaks in 6.4. The error message is:

      qrc:/MyTest/main.qml:12:3: Unable to assign QVariantList to QList<double>
      

      Attachments

        For Gerrit Dashboard: QTBUG-109584
        # Subject Branch Project Status CR V

        Activity

          People

            ulherman Ulf Hermann
            ulherman Ulf Hermann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes