'variable derived js object property
I need to add properties to a JS object in QML. I don't know the properties in advance. So I am stuck.
I found this topic with same issue: QML defining an object property
The only way to solve this coming up in my mind is to create a QMap on C++ side and to pass it back to QML.
Any other suggestions using JS?
Repeater{
model:3
delegate:
TextInput{
text:"zfs"
Component.onCompleted: {
var prop="name"
var obj=({prop:text})
//results in {prop:"zfs"} but I need {name:"zfs"}
// maybe c++ function: QMap createJSObject(prop,text)
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
