Вопрос

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?

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top