12-27-2012 11:26 AM
I have a ListView and would like to inject some elements in the container of the row, based upon very specific circumstances. Hence, I have to do this from c++. From a ListView object, I am using the children() method to get a ListItemComponent, a class only available in QML according to the Documentation. But how can I acess a child view of a ListView in C++ ?
12-27-2012 12:42 PM - edited 12-27-2012 01:05 PM
I don't know how to access the data from C++ if ListView was created using ListItemComponents.
But you can configure ListView to use a model (one of DataModel subclasses) and ListItemProvider to create the items. Then access the data using the model:
When model is updated listView will call ListItemProvider's updateItem() where you can make the changes to visuals.
Keeping a pointer to visual item to change it directly is unsafe because ListView owns it and can reuse it for other row at any moment.
02-17-2013 01:31 PM
Please provide more details about what you want to do. An example with cpp and qml will help to understand your goals.. Many devs complicate simple things.
You can use control delegates to change ui of listview items.
02-17-2013 06:24 PM
02-18-2013 04:41 AM