سؤال

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