Assigning values to an array, values not kept?
-
I can assign values to a variable property but not to an array here? ... values aren't kept.
@ Column {
id: tableproperty variant aa: [false, false] //issue... later property variant bb: false //this works ... Button { anchors.top: parent.top anchors.topMargin: 0//40 anchors.right: parent.right anchors.rightMargin: 0//50 corpFarmAware: true text: tr_NOOP("Next") onClicked: { table.aa[0] = false; table.aa[1] = true; cb0.checked = table.aa[0];//issue of arrays ?? cb1.checked = table.aa[1]; table.bb = true; cb2.checked = table.bb;//WORKS } }@
Also note that I will be modifying table.bb though out the code. This is watered down.
-
I'm sorry but I don't see what the issue is... are you getting any errors, or aa[0] has some unexpected value, or what?
-
I can assign to it initially. But after that I can't re-assign. After reading some documentation, it seems you can't re-assign to individual elements for lists, variants.
I have an array of buttons created with Repeater, but indexAt is not available. So since I couldn't index them I wanted to create an array to store/modify the selections. Can't seem to do either case.
-
You still have not given any error messages or such ;) I want to help, but I need information :D
It's been a while since I've worked with JS arrays, but I'll try to recall my findings. First, you should be using "var" property instead of a variant (in Qt5). It handles JS objects better.
Next, IIRC what I was doing was something like this:
@
property var myProperty: new Array()Component.onCompleted: {
myProperty.push("blah");
}// ...
onClicked: {
table.myProperty[0] = false;
}
@