ListView and changes in model
-
It is not possible to notify ListView about changes in QList (but you can reassign property with QList and it will help you). If you want notify declarative ListView about C++ model changes you should create class with QAbstractListModel inherited and notify via standard model mechanisms.
-
If you exposed the QList via setContextProperty, you will need to set the list again every time the data in it changes.
If you exposed the list via a Q_PROPERTY, you should emit the notify signal for that property every time the list data changes.
Either way, it won't happen by magic. You need to somehow communicate that the list has changed. If you want it to happen 'by magic', then use the QAbstractListModel approach (where you still have to indicate that it has changed, but once you indicate it to the model it will automatically propagate to QML).
-
There is a rather complete example for a folderlist in the docs:
http://doc.qt.nokia.com/4.7-snapshot/src-imports-folderlistmodel.html