Important: Please read the Qt Code of Conduct -

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