Pergunta

So I have the following case:

QML file:

import "Script.js" as MyScript

SomeItem{
    source: MyScript.getSource
}

JavaScript file ( Script.js ) :

function getSource(){
    return _SomeQtObject.getFromQtObjectSource();
}

Let's say I have some signals in the SomeQtObject based on which getSource should reevaluate. How do I bind those signals to the javaScript getSource function so that it reevaluates every time those signals are emitted?

Foi útil?

Solução

There is no way to force to reevaluate the result of javascript function automaticaly.

You have to create the slot which is connected to the apropriate signal of _SomeQtObject. In this slot you can reevaluate getSource() and assign it ro source.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top