Important: Please read the Qt Code of Conduct -

in qt6 QJSValue call not work properly

  • 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 =;
    		if (result.isError())
    			qWarning()<< result.toString();
    function Event(name, data){
    	console.Log("name=" + name);

    writes to the console

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

    help me please

Log in to reply