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

in qt6 QJSValue call not work properly

    XMLWordPrintable

Details

    • Windows

    Description

      Hi!
      I'm trying to port the code from qt5._
      i have codeĀ 

      void JSModule::Event(std::string name, std::string data) {
      
      	if (EventFunc.isCallable()) {
      		QJSValueList args;
      		args << QJSValue(QString::fromStdString(name)) << QJSValue(QString::fromStdString(data));
      
      		QJSValue result = EventFunc.call(args);
      		if (result.isError())
      		{
      			qWarning()<< result.toString();
      		}
      	}
      }
      
      function Event(name, data){
      	console.Log("name=" + name);
      }
      

      writes to the console

      Could not convert argument 0 at
             Event@:54
      TypeError: Passing incompatible arguments to C++ functions from JavaScript is not allowed.
      

      in qt5 all works..

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            andryski andryski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes