How to access ListView property inside delegate
Solved
QML and Qt Quick
-
I have two list views and using the same delegate to display the contents. I have defined the property inside list view. How do i access the properties defined in list view inside delegate.
I want to set the color property of delegate from the property defined in ListView
Component{ id:listcomp Text{text:name;font.pixelSize: 12;color:"white"} } ListView{ property color col: "blue" delegate:listcomp } ListView{ property color col: "red" delegate:listcomp }
-
ListView has property called contentItem. Delegate object will parented to contentItem. So you can use the following inside your delegate to set the property present inside your ListView.
Try
color :parent.parent.col -
Cool. That is nice. You can put the issue to SOLVED state.