[SOLVED ]color dialog currentColor offline seting
-
there is a ridiculous problem here
i have a list like this:property color["red","blue"]
and i want to change both blue and red color to green and yellow for example an i use one color dialog for this work as:
@
ColorDialog{
id:cd
property int itemw
showAlphaChannel: true
onAccepted:{
color[itemw]=currentColor
}
}@
and my problem is that currentColor will be set to my list dynamicly and in fact for itemw=1 my list change toproperty color["red",currentColor]
and if i change color list first item by this code the second one give this color olso
i can solve this problem by using a string temp variable as:
@
ColorDialog{
id:cd
property int itemw
property string temp
showAlphaChannel: true
onAccepted:{
temp=currentColor
color[itemw]=temp
}
}@
but opacity of color does not send to list and unfortunately i need it in my list
and also this list is dynamic and i cant use two colorDialog to solve my problemand my question simple form is how can set a variable value to a list element and not put it in that
-
Hi,
Instead use var type
@
property var colors : ["red","blue"]...
onAccepted: {
colors[colors.length+1] = currentColor
console.log(colors)
}
@To get the transparency i.e alpha value, use:
@
currentColor.a
@ -
or you can use currentAlpha ;)
Regarding the first question, why didn't it work ? What error did you get ?