I'm looking for code sample to collapse/expand ListItem
in QML.
Currently I have an idea to do it through toggling visible
flag for each child of triggered item. But I can't imagine how to iterate the children. Here is piece of code:
ListView {
dataModel: XmlDataModel {...}
onTriggered: {
var dataType = dataModel.itemType(indexPath)
if (dataType == "header")
{
var childrenCount = dataModel.childCount(indexPath);
for (int i = 0; i < childrenCount; i++)
{
// what to write here to get each child ListItem?
}
}
}
}
Thanks in advance.
PS: There is a sample for my task where we inherit from bb::cascades::DataModel
and override childCount
. But I would like to not deal with C++ classes.