comparison data/model/ModelDataTableModel.cpp @ 1582:70e172e6cc59 fix-static-analysis

Use nullptr throughout
author Chris Cannam
date Mon, 26 Nov 2018 14:33:41 +0000
parents ec9e65fcf749
children 91a194e2d80b
comparison
equal deleted inserted replaced
1581:ad5f892c0c4d 1582:70e172e6cc59
120 } 120 }
121 121
122 QModelIndex 122 QModelIndex
123 ModelDataTableModel::index(int row, int column, const QModelIndex &) const 123 ModelDataTableModel::index(int row, int column, const QModelIndex &) const
124 { 124 {
125 return createIndex(row, column, (void *)0); 125 return createIndex(row, column, (void *)nullptr);
126 } 126 }
127 127
128 QModelIndex 128 QModelIndex
129 ModelDataTableModel::parent(const QModelIndex &) const 129 ModelDataTableModel::parent(const QModelIndex &) const
130 { 130 {
151 QModelIndex 151 QModelIndex
152 ModelDataTableModel::getModelIndexForFrame(sv_frame_t frame) const 152 ModelDataTableModel::getModelIndexForFrame(sv_frame_t frame) const
153 { 153 {
154 if (!m_model) return createIndex(0, 0); 154 if (!m_model) return createIndex(0, 0);
155 int row = m_model->getRowForFrame(frame); 155 int row = m_model->getRowForFrame(frame);
156 return createIndex(getSorted(row), 0, (void *)0); 156 return createIndex(getSorted(row), 0, (void *)nullptr);
157 } 157 }
158 158
159 sv_frame_t 159 sv_frame_t
160 ModelDataTableModel::getFrameForModelIndex(const QModelIndex &index) const 160 ModelDataTableModel::getFrameForModelIndex(const QModelIndex &index) const
161 { 161 {
198 m_sortColumn = column; 198 m_sortColumn = column;
199 m_sortOrdering = sortOrder; 199 m_sortOrdering = sortOrder;
200 int current = getCurrentRow(); 200 int current = getCurrentRow();
201 if (current != prevCurrent) { 201 if (current != prevCurrent) {
202 // cerr << "Current row changed from " << prevCurrent << " to " << current << " for underlying row " << m_currentRow << endl; 202 // cerr << "Current row changed from " << prevCurrent << " to " << current << " for underlying row " << m_currentRow << endl;
203 emit currentChanged(createIndex(current, 0, (void *)0)); 203 emit currentChanged(createIndex(current, 0, (void *)nullptr));
204 } 204 }
205 emit layoutChanged(); 205 emit layoutChanged();
206 } 206 }
207 207
208 void 208 void
230 QModelIndex ix0 = getModelIndexForFrame(f0); 230 QModelIndex ix0 = getModelIndexForFrame(f0);
231 QModelIndex ix1 = getModelIndexForFrame(f1); 231 QModelIndex ix1 = getModelIndexForFrame(f1);
232 int row0 = ix0.row(); 232 int row0 = ix0.row();
233 int row1 = ix1.row(); 233 int row1 = ix1.row();
234 if (row0 > 0) { 234 if (row0 > 0) {
235 ix0 = createIndex(row0 - 1, ix0.column(), (void *)0); 235 ix0 = createIndex(row0 - 1, ix0.column(), (void *)nullptr);
236 } 236 }
237 if (row1 + 1 < rowCount()) { 237 if (row1 + 1 < rowCount()) {
238 ix1 = createIndex(row1 + 1, ix1.column(), (void *)0); 238 ix1 = createIndex(row1 + 1, ix1.column(), (void *)nullptr);
239 } 239 }
240 SVDEBUG << "emitting dataChanged from row " << ix0.row() << " to " << ix1.row() << endl; 240 SVDEBUG << "emitting dataChanged from row " << ix0.row() << " to " << ix1.row() << endl;
241 emit dataChanged(ix0, ix1); 241 emit dataChanged(ix0, ix1);
242 clearSort(); 242 clearSort();
243 emit layoutChanged(); 243 emit layoutChanged();
244 } 244 }
245 245
246 void 246 void
247 ModelDataTableModel::modelAboutToBeDeleted() 247 ModelDataTableModel::modelAboutToBeDeleted()
248 { 248 {
249 m_model = 0; 249 m_model = nullptr;
250 emit modelRemoved(); 250 emit modelRemoved();
251 } 251 }
252 252
253 int 253 int
254 ModelDataTableModel::getSorted(int row) const 254 ModelDataTableModel::getSorted(int row) const