
Originally Posted by
don@thegagnes.com
As far as setting an id from the C++ side I was just trying to figure out how to use your example. The objects are all created in C++ and then pushed into a QML context. Given that, using an id won't work.
You surely have a QML declaration somewhere which refers to a particular parameter (and you can do that via id), otherwise your QML code wouldn't know how to "call" a particular parameter as it might not exist.
If I use a list model I won't be able to do something like this in QML will I?
TextInput {
text: parameters.PROP_1.value
}
If you put that in a delegate referencing a particular model entry then it would be simpler:
ListView {
id: view
model: myModel
// ...
Row {
width: view.width
Text { text: model.name }
Slider {
minimumValue: model.minimum
maximumValue: model.maximum
value: model.value
onValueChanged: model.value = value
}
Text { text: model.value }
}
}
ListView {
id: view
model: myModel
// ...
Row {
width: view.width
Text { text: model.name }
Slider {
minimumValue: model.minimum
maximumValue: model.maximum
value: model.value
onValueChanged: model.value = value
}
Text { text: model.value }
}
}
To copy to clipboard, switch view to plain text mode
You could even have different types of parameters and construct a proper delegate depending on the type (e.g. putting a slider for numeric parameters and text field for textual ones).
Bookmarks