06-27-2013 04:47 AM
I have two QVariantLists that contain QVariantMaps.
How do I structure the overall QVariantList container to be compatible with a GroupDataModel? I am trying to achieve the same tree hierachy at http://developer.blackberry.com/cascades/reference
So for example:
QVariantList -- header1 -- listItems
------------ header 2 --- listitems
What I tried to do in C++:
//Should be 'branch' 0 QVariantList beforeList; beforeList.append(beforeMap); //Should be 'branch' 1 QVariantList afterList; afterList.append(afterMap); QVariantList mainList; mainList.append(beforeList); mainList.append(afterList);
This excludes the headers. The ListView does display but all index paths are 0,x.
Could someone show me in C++ how to create the two branches with their headers?
Solved! Go to Solution.
06-27-2013 04:57 AM
you should use sort fields to sort the list and group by a property of your data
then you'll get headers automatically and you can decide if Header contains complete value or only first character
the order of your List doesn't matter - GroupDataModel will sort and group it for you and provide Header and Items.
06-27-2013 05:02 AM - edited 06-27-2013 05:03 AM
So if I understand correctly I should go the route of: groupDataModel(QStringList() << "header" << "item").
But then how do I do that in code? Thats where I'm struggling.
06-27-2013 05:05 AM
I'm defining this in QML
only providing and managing the data of this GroupDataModel from C++
perhaps Simon will jump in - if I understand right he is doing these things from C++ ;-)