Index: sources/model/MListModel.h =================================================================== diff -u -r8c7b9550b05f223be9d094e850e06f9ed80adb70 -rc1e50347c78096b626b2cd1ef32a33b439e88bdd --- sources/model/MListModel.h (.../MListModel.h) (revision 8c7b9550b05f223be9d094e850e06f9ed80adb70) +++ sources/model/MListModel.h (.../MListModel.h) (revision c1e50347c78096b626b2cd1ef32a33b439e88bdd) @@ -17,23 +17,31 @@ { Q_OBJECT + Q_PROPERTY(int count READ rowCount NOTIFY countChanged STORED false) + public: - explicit MListModel(QObject *parent = nullptr) : QAbstractListModel (parent) { } + explicit MListModel(QObject *parent = nullptr); QHash roleNames ( ) const override; int rowCount (const QModelIndex & = QModelIndex() ) const override; QVariant data (const QModelIndex &vIndex, int vRole = Qt::DisplayRole ) const override; bool setData (const QModelIndex &vIndex, const QVariant& vValue, int vRole = Qt::EditRole) override; void clear ( ); void setRoleNames(const QHash& vRoleNames ); + void appendRow (const QHash &vData ); + void insertRow (const int vRow, const QHash &vData ); + void updateData (const int vRow, const int vRole, const QVariant& vValue ); MListModel &operator = (const QList> &src ); -public slots: +public Q_SLOTS: QVariantMap get (int vRow ) const; // Exposed to QML +Q_SIGNALS: + void countChanged(); + private: QList> _data; QHash _roleNames; - }; -} + +} // namespace View