comparison data/model/ModelDataTableModel.cpp @ 929:59e7fe1b1003 warnfix_no_size_t

Unsigned removals and warning fixes in data/
author Chris Cannam
date Tue, 17 Jun 2014 14:33:42 +0100
parents e802e550a1f2
children cd42620e3f40
comparison
equal deleted inserted replaced
928:6a94bb528e9d 929:59e7fe1b1003
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(modelChanged(size_t, size_t)), 34 connect(baseModel, SIGNAL(modelChanged(int, int)),
35 this, SLOT(modelChanged(size_t, size_t))); 35 this, SLOT(modelChanged(int, int)));
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()
103 103
104 return (command ? true : false); 104 return (command ? true : false);
105 } 105 }
106 106
107 Qt::ItemFlags 107 Qt::ItemFlags
108 ModelDataTableModel::flags(const QModelIndex &index) const 108 ModelDataTableModel::flags(const QModelIndex &) const
109 { 109 {
110 Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsEditable | 110 Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsEditable |
111 Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsSelectable; 111 Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsSelectable;
112 return flags; 112 return flags;
113 } 113 }
125 } 125 }
126 return QVariant(); 126 return QVariant();
127 } 127 }
128 128
129 QModelIndex 129 QModelIndex
130 ModelDataTableModel::index(int row, int column, const QModelIndex &parent) const 130 ModelDataTableModel::index(int row, int column, const QModelIndex &) const
131 { 131 {
132 return createIndex(row, column, (void *)0); 132 return createIndex(row, column, (void *)0);
133 } 133 }
134 134
135 QModelIndex 135 QModelIndex
136 ModelDataTableModel::parent(const QModelIndex &index) const 136 ModelDataTableModel::parent(const QModelIndex &) const
137 { 137 {
138 return QModelIndex(); 138 return QModelIndex();
139 } 139 }
140 140
141 int 141 int
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(size_t frame) const 158 ModelDataTableModel::getModelIndexForFrame(int 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 size_t 165 int
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::modelChanged(size_t f0, size_t f1) 222 ModelDataTableModel::modelChanged(int, int)
223 { 223 {
224 //!!! inefficient 224 //!!! inefficient
225 clearSort(); 225 clearSort();
226 emit layoutChanged(); 226 emit layoutChanged();
227 } 227 }
248 248
249 if (m_sort.empty()) { 249 if (m_sort.empty()) {
250 resort(); 250 resort();
251 } 251 }
252 int result = 0; 252 int result = 0;
253 if (row >= 0 && row < m_sort.size()) { 253 if (row >= 0 && row < (int)m_sort.size()) {
254 result = m_sort[row]; 254 result = m_sort[row];
255 } 255 }
256 if (m_sortOrdering == Qt::DescendingOrder) { 256 if (m_sortOrdering == Qt::DescendingOrder) {
257 result = rowCount() - result - 1; 257 result = rowCount() - result - 1;
258 } 258 }
276 if (m_sort.empty()) { 276 if (m_sort.empty()) {
277 resort(); 277 resort();
278 } 278 }
279 279
280 int result = 0; 280 int result = 0;
281 if (row >= 0 && row < m_sort.size()) { 281 if (row >= 0 && row < (int)m_sort.size()) {
282 if (m_sortOrdering == Qt::AscendingOrder) { 282 if (m_sortOrdering == Qt::AscendingOrder) {
283 result = m_rsort[row]; 283 result = m_rsort[row];
284 } else { 284 } else {
285 result = m_rsort[rowCount() - row - 1]; 285 result = m_rsort[rowCount() - row - 1];
286 } 286 }
307 307
308 std::map<int, int> tmp; 308 std::map<int, int> tmp;
309 309
310 // rsort maps from sorted row number to original row number 310 // rsort maps from sorted row number to original row number
311 311
312 for (int i = 0; i < m_rsort.size(); ++i) { 312 for (int i = 0; i < (int)m_rsort.size(); ++i) {
313 tmp[m_rsort[i]] = i; 313 tmp[m_rsort[i]] = i;
314 } 314 }
315 315
316 // tmp now maps from original row number to sorted row number 316 // tmp now maps from original row number to sorted row number
317 317