#pragma once // Qt #include #include #include #include // Project #include "main.h" // Doxygen : do not remove #include "VView.h" // namespace namespace View { class MListModel : public QAbstractListModel { Q_OBJECT Q_PROPERTY(int count READ rowCount NOTIFY countChanged STORED false) public: explicit MListModel(QObject *parent = nullptr); void insertRow (const int pos, const QHash &vData ); 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 ); public Q_SLOTS: QVariantMap get (int vRow ) const; // Exposed to QML Q_SIGNALS: void countChanged(); private: QList> _data; QHash _roleNames; }; }