Search code examples
blackberry-10

BlackBerry 10: Load GroupDataModel data into a JSON file?


I have a ListView in QML using a cpp GroupDataModel that is created from a .json file in the assets folder. Items from this ListView are removed and added to. In cpp how do I get the GroupDataModel data into the JSON file?

I know there is this:

JsonDataAccess jda;
jda.save(huh?, "/app/native/assets/employees.json");

How do I get the GroupDataModel data into a QVariant to put in the first parameter of that function? I can't just stick my m_model GroupDataModel in there; it causes an error.


Solution

  • You have to iterate over your model with GroupDataModel::data() and GroupDataModel::childCount() to create your resulting QVariant, then store it. As far as I know, there's no automatic way to do this.

    Edit: there is one.