comparison data/model/ModelDataTableModel.h @ 1748:91a194e2d80b by-id

Update to ModelId
author Chris Cannam
date Wed, 03 Jul 2019 14:20:19 +0100
parents c01cbe41aeb5
children 356be36b2391
comparison
equal deleted inserted replaced
1747:498b426191e5 1748:91a194e2d80b
20 20
21 #include <vector> 21 #include <vector>
22 22
23 #include "base/BaseTypes.h" 23 #include "base/BaseTypes.h"
24 24
25 #include "TabularModel.h"
26 #include "Model.h"
27
25 class TabularModel; 28 class TabularModel;
26 class Command; 29 class Command;
27 30
28 class ModelDataTableModel : public QAbstractItemModel 31 class ModelDataTableModel : public QAbstractItemModel
29 { 32 {
30 Q_OBJECT 33 Q_OBJECT
31 34
32 public: 35 public:
33 ModelDataTableModel(TabularModel *m); 36 ModelDataTableModel(ModelId modelId); // a TabularModel
34 virtual ~ModelDataTableModel(); 37 virtual ~ModelDataTableModel();
35 38
36 QVariant data(const QModelIndex &index, int role) const override; 39 QVariant data(const QModelIndex &index, int role) const override;
37 40
38 bool setData(const QModelIndex &index, const QVariant &value, int role) override; 41 bool setData(const QModelIndex &index, const QVariant &value, int role) override;
73 void modelChanged(); 76 void modelChanged();
74 void modelChangedWithin(sv_frame_t, sv_frame_t); 77 void modelChangedWithin(sv_frame_t, sv_frame_t);
75 void modelAboutToBeDeleted(); 78 void modelAboutToBeDeleted();
76 79
77 protected: 80 protected:
78 TabularModel *m_model; 81 std::shared_ptr<TabularModel> getTabularModel() const {
82 return ModelById::getAs<TabularModel>(m_model);
83 }
84
85 ModelId m_model;
79 int m_sortColumn; 86 int m_sortColumn;
80 Qt::SortOrder m_sortOrdering; 87 Qt::SortOrder m_sortOrdering;
81 int m_currentRow; 88 int m_currentRow;
82 typedef std::vector<int> RowList; 89 typedef std::vector<int> RowList;
83 mutable RowList m_sort; 90 mutable RowList m_sort;