Call a imported js function in C++



  • I have known that I can call a qml function in C++ using "QMetaObject::invokeMethod", but when the function is imported from an external js file in qml, I mean using:

    // file main.qml
    import "Handler.js" as Hander

    // file Handler.js
    function testCall() {

    }

    when I use "QMetaObject::invokeMethod(root, "Handler.testCall")", it does not work. How shoud I do?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.