Solved How we set a varrible out of MouseArea in Window type or Image Type?
-
conetnt file.js
//js source var varone;
conetent file Qml
import file.js as jlib Window{jlib.varone:1; }
when i inspect with the below source it print undefined!!!!!1
console.debug(jlib.varone);
how can i solve my problem.thanks for reply.
-
Add ".pragma library" to your Javascript file, and you need to set via Javascript statement like "jlib.varone = 1"
-
@benlau i added ".pragma library" to it,(default has) when i write ".pragma library" the IDE show error.
-
@stackprogramer said:
@benlau i added ".pragma library" to it,(default has) when i write ".pragma library" the IDE show error.
No double quote.
And I mean your QML statement is wrong. You need to set via Javascript statement.
e.g
Window { Component.onCompleted : { jlib.varone = 1; } }
-
i did n't use this method,now that i use it my problem was solved thanks for reply.
Component.onCompleted: { }