Index: sources/model/MListModel.h =================================================================== diff -u -rf433eeefae34530e7cc3dc4e5576e43729b236f2 -rc1e50347c78096b626b2cd1ef32a33b439e88bdd --- sources/model/MListModel.h (.../MListModel.h) (revision f433eeefae34530e7cc3dc4e5576e43729b236f2) +++ sources/model/MListModel.h (.../MListModel.h) (revision c1e50347c78096b626b2cd1ef32a33b439e88bdd) @@ -17,26 +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 ); - MListModel &operator = (const QList> &src ); 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