Variable declarations
-
How do I declare a global and non-global variable?
I tried "var Key = 1"
but I am having error when I try to debug. -
bq. I don’t know if there is a way of declaring “global” variable for all QML files.
yes, with
@.pragma library
vak key = 1;@on top of the .js code
Edit: if I remember well, in Creator when you create a new .js file, it asks about create a stateless library
Edit 2: "here":http://qt-project.org/doc/qt-4.8/qdeclarativejavascript.html#stateless-javascript-libraries a reference