i've created a qml file soundOption.qml

Qt Code:
  1. function toggle() {
  2. if (soundOption.state == "on")
  3. soundOption.state = "off"
  4. else
  5. soundOption.state = "on"
  6. }
To copy to clipboard, switch view to plain text mode 

when accessing to other qml, it is always in default setup.

default is "on", then i switched it to "off"
when i am on other qml and i want it to switch back "on", it was already "on"
i can only switch it on and off when i am on the same qml file...

in other qml file:
Qt Code:
  1. soundOption {
  2. ....
  3. onClicked: soundOption.toggle()
  4. }
To copy to clipboard, switch view to plain text mode 
pls help