Blame view

src/memorymodel/memorymodel.h 1.18 KB
25f07764   Peter M. Groen   Implementing the ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  #pragma once
  
  #include <QAbstractItemModel>
  #include <QVector>
  #include <QHash>
  
  class MemoryModel : public QAbstractItemModel
  {
      Q_OBJECT
  
  public:
      explicit MemoryModel(int segments = 10, int registers_per_segment = 10, QObject *parent = nullptr);
      virtual ~MemoryModel() override {}
  
      virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
      virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
      virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
      virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
      virtual QModelIndex parent(const QModelIndex &index) const override;
      virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
      virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
      virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override;
  
  private:
      QHash<int, QVector<uint16_t>>   m_memoryData;
      QStringList                     m_headers;
  };