Mercurial > hg > svgui
comparison widgets/CSVFormatDialog.cpp @ 971:fd934705973f
Fix crash when importing wide CSV file
author | Chris Cannam |
---|---|
date | Fri, 22 May 2015 10:42:15 +0100 |
parents | 2633a1d73e39 |
children | e5d40d89b1ec |
comparison
equal
deleted
inserted
replaced
970:1c37aa13bfd8 | 971:fd934705973f |
---|---|
250 } | 250 } |
251 | 251 |
252 void | 252 void |
253 CSVFormatDialog::applyStartTimePurpose() | 253 CSVFormatDialog::applyStartTimePurpose() |
254 { | 254 { |
255 // First check if we already have any | 255 // First check if we already have any. NB there may be fewer than |
256 for (int i = 0; i < m_format.getColumnCount(); ++i) { | 256 // m_format.getColumnCount() elements in m_columnPurposeCombos |
257 // (because of the fuzzy column behaviour) | |
258 for (int i = 0; i < m_columnPurposeCombos.size(); ++i) { | |
257 QComboBox *cb = m_columnPurposeCombos[i]; | 259 QComboBox *cb = m_columnPurposeCombos[i]; |
258 if (cb->currentIndex() == int(CSVFormat::ColumnStartTime)) { | 260 if (cb->currentIndex() == int(CSVFormat::ColumnStartTime)) { |
259 return; | 261 return; |
260 } | 262 } |
261 } | 263 } |
262 // and if not, select one | 264 // and if not, select one |
263 for (int i = 0; i < m_format.getColumnCount(); ++i) { | 265 for (int i = 0; i < m_columnPurposeCombos.size(); ++i) { |
264 QComboBox *cb = m_columnPurposeCombos[i]; | 266 QComboBox *cb = m_columnPurposeCombos[i]; |
265 if (cb->currentIndex() == int(CSVFormat::ColumnValue)) { | 267 if (cb->currentIndex() == int(CSVFormat::ColumnValue)) { |
266 cb->setCurrentIndex(int(CSVFormat::ColumnStartTime)); | 268 cb->setCurrentIndex(int(CSVFormat::ColumnStartTime)); |
267 return; | 269 return; |
268 } | 270 } |
270 } | 272 } |
271 | 273 |
272 void | 274 void |
273 CSVFormatDialog::removeStartTimePurpose() | 275 CSVFormatDialog::removeStartTimePurpose() |
274 { | 276 { |
275 for (int i = 0; i < m_format.getColumnCount(); ++i) { | 277 // NB there may be fewer than m_format.getColumnCount() elements |
278 // in m_columnPurposeCombos (because of the fuzzy column | |
279 // behaviour) | |
280 for (int i = 0; i < m_columnPurposeCombos.size(); ++i) { | |
276 QComboBox *cb = m_columnPurposeCombos[i]; | 281 QComboBox *cb = m_columnPurposeCombos[i]; |
277 if (cb->currentIndex() == int(CSVFormat::ColumnStartTime)) { | 282 if (cb->currentIndex() == int(CSVFormat::ColumnStartTime)) { |
278 cb->setCurrentIndex(int(CSVFormat::ColumnValue)); | 283 cb->setCurrentIndex(int(CSVFormat::ColumnValue)); |
279 } | 284 } |
280 } | 285 } |