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

    • Windows
    • e887f25dd6c4c9630a7367c3a2ed95a284191843 (qt/qtdeclarative/dev) b2fccf2f2d15c91cf52ca9a2a779eae3004f8b55 (qt/qtdeclarative/6.1) c48ba63c9001a6965f3ea7e0ddbceacf994f777e (qt/qtdeclarative/6.0)

    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

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

        Activity

          People

            max.goldstein Maximilian Goldstein
            -mtuokko- Mikko Tuokko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes