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

QList<int> is converted to int by qmlsc

XMLWordPrintable

    • e303d1282 (dev), 411f6cce0 (6.7), 7d3204ff0 (6.6), dd865c1a6 (tqtc/lts-6.5)

      I have a Q_INVOKABLE method that returns QList<int>. The method does work in cpp but when called from QML/JS

       

      var list = listProvider.intList() 
      console.log(list)

      this gives me '0'

       

      But if I do:

      console.log(list, list.length) 

      it gives me '[0,1,2,3,4] 5'

       

      So it means that when qmlsc is unable to compile the js function (because of using the length property of the array) it works properly but when qmlsc does compile the function it missunderstand the QList<int> return type

       

      And apparently, it seems to work when using QList<int> with Q_PROPERTY

       

      See the attached project to test yourself

       

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

            olivier.decanniere Olivier De Cannière
            romain.donze Romain Donzé
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes