Hi,

i am trying to implement a menu with several sub-menus. Therefore when changing to a sub-menu, I want to push the current color information into an array / var property, like I do with the actions themselves. The problem: I cannot copy the value of a color. It's always the reference that is copied, so the whole storing process becomes pointless, the stored color changes as soon as I assign the new color.

the QML properties are:
Qt Code:
  1. property alias color: actionBarMainRect.color;
  2. property var colorsUpperLevel: []
To copy to clipboard, switch view to plain text mode 

In JS I use this code
Qt Code:
  1. var color = actionBarLeft.color
  2.  
  3. actionBarLeft.colorsUpperLevel.push(color)
  4.  
  5. console.log("pushed color1: "+ actionBarLeft.colorsUpperLevel[actionBarLeft.colorsUpperLevel.length-1])
  6. console.log("actionBarLeft.color1" + actionBarLeft.color)
  7. console.log("menuColor1: "+menuColor)
  8. console.log("color1: "+color)
  9.  
  10. actionBarLeft.color = menuColor
  11.  
  12. console.log("pushed color2: "+ actionBarLeft.colorsUpperLevel[actionBarLeft.colorsUpperLevel.length-1])
  13. console.log("actionBarLeft.color2" + actionBarLeft.color)
  14. console.log("menuColor2: "+menuColor)
  15. console.log("color2: "+color)
To copy to clipboard, switch view to plain text mode 

with this result:
qml: pushed color1: #008400 // old color, stored correctly
qml: actionBarLeft.color1#008400 // still old
qml: menuColor1: #8400ff // the new color
qml: color1: #008400 // everything ok
//---> Now the assignment happens
qml: pushed color2: #8400ff // ok, we wanted to change this.
qml: actionBarLeft.color2#8400ff // but not this!!
qml: menuColor2: #8400ff
qml: color2: #8400ff // and not this!!
Any ideas?