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

Missing string conversion in QJSValue parameter in a c++ signal connected to QML

    XMLWordPrintable

    Details

    • Platform/s:
      Windows

      Description

      QJSValue parameter in a signal in QML c++ plugin is not converted properly when

      the signal is connected to in QML. Specifically, a QJSValue constructed from a QString value is not working. Steps to reproduce.

       

      QML c++ plugin header

       

      signals:

        test(const QJSValue& param);

       

      QML c++ plugin source code

      emit test(QJSValue(QString("foo"));

       

      QML (connecting to signal):

      onTest: // (param)

      {   console.log(param); // prints undefined. }

      There is related old fixed bug report, where this was fixed for integers passed in QJSValue signal parameter, but string metatype support is missing in the QJSValuePrivate::valueForData().

      https://codereview.qt-project.org/c/qt/qtdeclarative/+/182673

      Of course, at the same time, the completeness of that function should be cross-checked for other metatypes as well.

        Attachments

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

          Activity

            People

            Assignee:
            ulherman Ulf Hermann
            Reporter:
            -mtuokko- Mikko Tuokko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes