I'm having trouble finding a good way to display the items of a std::map
in QML. We're using a MVVM pattern in our application. The std::map
contains file paths and is a member of a configuration class in the model.
Now I'm trying to show all entries of the map in QML, probably using a ListView
item.
Currently we just have a couple of file paths in the configuration, so these are exposed as Q_PROPERTY
ies to the view model and then further to QML. But, of course, the number of paths can and will grow, thus my idea using a std::map
for this. It won't be necessary to have it 'growable' at runtime, at least not in the forseeable future. But writing lots and lots of Q_PROPERTY
ies doesn't seem the right way for me.
Furhter question: How would I access/display the items of the map in a QML ListView
- I can't figure it out and I can't find anything helpful online.