Is it possible to pass ListModel to ListView with some missing parameters?
-
Did you try this out ?? what is the problem you are facing...
-
[quote author="aabc" date="1310297954"]Is it possible to pass ListModel to ListView with some missing parameters?
Is there a way to write a delegate that uses only the parameters that the model gave it and use default parameters for those who dont?[/quote]Yes, you totally can do that. Check the sample below:
@ListModel {
ListElement {
label: QT_TR_NOOP("Item 1")
value: "item1"
}
ListElement {
label: QT_TR_NOOP("Item 2")
value: "item2"
position: "left"
disabled: "true"
}
}@
Then in the delegate:@Item {
state: (typeof model.disabled != "undefined" && model.disabled == "true" ? "disabled" : "")
anchors.centerIn: (typeof model.position == "undefined" || model.position == "left" : leftContainer ? rightContainer);
}@