Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. in qt6 QJSValue call not work properly
Forum Updated to NodeBB v4.3 + New Features

in qt6 QJSValue call not work properly

Scheduled Pinned Locked Moved Unsolved Qt 6
qjsvalueqmlqt6
1 Posts 1 Posters 378 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andryski
    wrote on last edited by
    #1

    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.
    

    help me please

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved