[SOLVED] QJSEngine: how to get signal parameter of QObject inside javascript code?



  • For example i have a class "someClass" which inherits QObject and has a signal "valueChanged(int val)".

    Now i can make that class available in QJSEngine via
    @QJSEngine *jse = new QJSEngine(this);
    someClass *s = new someClass(this);
    QJSValue so = jse->newQObject(s);
    jse->globalObject().setProperty("theclass", so);@

    and evaluate javascript code to "connect" to that signal
    @jse->evaluate("theclass.onValueChanged = function () {/dosomething/}()");@

    but how do i get the parameter of that signal inside the javascript code?



  • Well after looking into QtScript i found the right way to connect signals in javascript code.

    @theclass.valueChanged.connect(this, function (signalparam) {});@


Log in to reply
 

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