Mercurial > hg > svcore
comparison data/model/ModelDataTableModel.cpp @ 1057:5c5d4863b428 tonioni
Merge from cxx11 branch
author | Chris Cannam |
---|---|
date | Mon, 23 Mar 2015 11:26:28 +0000 |
parents | 2f49be7d4264 |
children | cbdd534f517a |
comparison
equal
deleted
inserted
replaced
1056:c4898e57eea5 | 1057:5c5d4863b428 |
---|---|
29 m_currentRow(0) | 29 m_currentRow(0) |
30 { | 30 { |
31 Model *baseModel = dynamic_cast<Model *>(m); | 31 Model *baseModel = dynamic_cast<Model *>(m); |
32 | 32 |
33 connect(baseModel, SIGNAL(modelChanged()), this, SLOT(modelChanged())); | 33 connect(baseModel, SIGNAL(modelChanged()), this, SLOT(modelChanged())); |
34 connect(baseModel, SIGNAL(modelChangedWithin(int, int)), | 34 connect(baseModel, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)), |
35 this, SLOT(modelChangedWithin(int, int))); | 35 this, SLOT(modelChangedWithin(sv_frame_t, sv_frame_t))); |
36 connect(baseModel, SIGNAL(aboutToBeDeleted()), | 36 connect(baseModel, SIGNAL(aboutToBeDeleted()), |
37 this, SLOT(modelAboutToBeDeleted())); | 37 this, SLOT(modelAboutToBeDeleted())); |
38 } | 38 } |
39 | 39 |
40 ModelDataTableModel::~ModelDataTableModel() | 40 ModelDataTableModel::~ModelDataTableModel() |
153 if (parent.isValid()) return 0; | 153 if (parent.isValid()) return 0; |
154 return m_model->getColumnCount(); | 154 return m_model->getColumnCount(); |
155 } | 155 } |
156 | 156 |
157 QModelIndex | 157 QModelIndex |
158 ModelDataTableModel::getModelIndexForFrame(int frame) const | 158 ModelDataTableModel::getModelIndexForFrame(sv_frame_t frame) const |
159 { | 159 { |
160 if (!m_model) return createIndex(0, 0); | 160 if (!m_model) return createIndex(0, 0); |
161 int row = m_model->getRowForFrame(frame); | 161 int row = m_model->getRowForFrame(frame); |
162 return createIndex(getSorted(row), 0, (void *)0); | 162 return createIndex(getSorted(row), 0, (void *)0); |
163 } | 163 } |
164 | 164 |
165 int | 165 sv_frame_t |
166 ModelDataTableModel::getFrameForModelIndex(const QModelIndex &index) const | 166 ModelDataTableModel::getFrameForModelIndex(const QModelIndex &index) const |
167 { | 167 { |
168 if (!m_model) return 0; | 168 if (!m_model) return 0; |
169 return m_model->getFrameForRow(getUnsorted(index.row())); | 169 return m_model->getFrameForRow(getUnsorted(index.row())); |
170 } | 170 } |
217 clearSort(); | 217 clearSort(); |
218 emit layoutChanged(); | 218 emit layoutChanged(); |
219 } | 219 } |
220 | 220 |
221 void | 221 void |
222 ModelDataTableModel::modelChangedWithin(int, int) | 222 ModelDataTableModel::modelChangedWithin(sv_frame_t, sv_frame_t) |
223 { | 223 { |
224 //!!! inefficient | 224 //!!! inefficient |
225 clearSort(); | 225 clearSort(); |
226 emit layoutChanged(); | 226 emit layoutChanged(); |
227 } | 227 } |