TableView: access model properties from delegate
-
I have a TableView for which I've defined my own itemDelegate. Now, from within this delegate I can access the value for the column using styleData.value, but I'd also need to access the other properties in this same item but I can't find how to.
I need this, because the text styling needs to change depending on some other property of the item model.
Any ideas? thanks!
(btw I also posted this on here: http://stackoverflow.com/questions/22874387/qml-tableview-access-model-properties-from-delegate)
-
Yea the style thing was probably extra unnecessary info.
I'm writing a custom "itemDelegate":https://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-tableview.html#itemDelegate-prop.
The documentation mentions which values are available here. One of them is styleData.value which is the model item for that particular column. What I would like to be able to access is the other columns for the same item model (same row in the table).
The model is a ListModel composed of ListElements.
thanks!
-
Note. Because of this inconsistence and after considerable debate we actually changed the behaviour of TableView in 5.3 to be more aligned with ListView.
The "model" property in 5.3 should be the same as it is in ListView. If you try the 5.3 beta, it is already behaving like ListView. Unfortunately, this also means the proposed snippet above will actually stop working.