QML view wont update when adding a new item to a QAbstractListModel based model
问题 I've figured out how to bind a model derived from QAbstractListModel to a QML view. But the next thing I tired does not work. If a new Item is added to the model the QML view will not update. Why is that? DataObject.h class DataObject { public: DataObject(const QString &firstName, const QString &lastName): first(firstName), last(lastName) {} QString first; QString last; }; SimpleListModel.h class SimpleListModel : public QAbstractListModel { Q_OBJECT enum /*class*/ Roles { FIRST_NAME = Qt: