Hi,
The docs mention it, but I can't seem to get it to work.
I am trying to get items in a list to bind to values from the model that is
assigned.
Here are some things I have tried:
Component {
id: bardelegate
Rectangle {
...
Rectangle {
id: self
...
opacity: selected ? 0.6 : 1.0
property bool itemSelected: model.selected
onItemSelectedChanged: opacity = itemSelected ? 0.6 : 1.0
Binding { target: self; property: "itemSelected"; value:
model.selected }
states: [
State {
name: "selected"
when: itemSelected
PropertyChanges {
target: self
opacity: 0.6
}
}
]
}
}
...
}
When I grab the model item and change the property: model.get(x).selected = true
The visual item does not change, I have checked to see that the model item
property it getting set correctly: console.log("item selected: " +
model.get(x).selected)
Anyone have any luck with this, is it supposed to work?
Here's the model code:
ListModel {
id: filteritems
ListElement { name: "people"; selected: true }
ListElement { name: "time"; selected: false }
}
My setup is a little more complex, as I am writing all my components in QML
directly instead of any C++ (Crazy? maybe.) So there are a few levels of
components going on, but everything else is working just fine.
Thanks for looking!
Alan
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml