Howto define global variables ?
-
Hello,
can some one explain me how to declare global variables in my Qt Quick Application ?
I use "this template":http://doc.qt.nokia.com/qtmobility-1.2/qml-positionsource.html#details
Thank you
-
Hello,
Can you explain a bit more? What do you mean by "global variable"?
-
I mean a variable that can be accessed (read and modified) by every function.
For example in Delphi, these have to be declared at the very beginning.
-
Take a look at "this":http://doc.qt.nokia.com/4.7-snapshot/qdeclarativescope.html#component-instance-hierarchy
-
So, is it @property <data type> <variable name>@ ?
And then, how can I change the value e.g.
@ Item {
id: root
property string title...
string = string + "xyz"
onClick { string = string + "abc" }
}@
?
-
You can change the value on some event ( line onClicked ), when state changes with ( "PropertyChanges":http://doc.qt.nokia.com/4.7-snapshot/qml-propertychanges.html ) or during transitions using animations.