diff widgets/CSVFormatDialog.cpp @ 972:1011ffb1b6d5 osx-retina

Merge from default branch
author Chris Cannam
date Wed, 10 Jun 2015 13:38:02 +0100
parents fd934705973f
children e5d40d89b1ec
line wrap: on
line diff
--- a/widgets/CSVFormatDialog.cpp	Thu May 21 16:05:14 2015 +0100
+++ b/widgets/CSVFormatDialog.cpp	Wed Jun 10 13:38:02 2015 +0100
@@ -252,15 +252,17 @@
 void
 CSVFormatDialog::applyStartTimePurpose()
 {
-    // First check if we already have any
-    for (int i = 0; i < m_format.getColumnCount(); ++i) {
+    // First check if we already have any. NB there may be fewer than
+    // m_format.getColumnCount() elements in m_columnPurposeCombos
+    // (because of the fuzzy column behaviour)
+    for (int i = 0; i < m_columnPurposeCombos.size(); ++i) {
         QComboBox *cb = m_columnPurposeCombos[i];
         if (cb->currentIndex() == int(CSVFormat::ColumnStartTime)) {
             return;
         }
     }
     // and if not, select one
-    for (int i = 0; i < m_format.getColumnCount(); ++i) {
+    for (int i = 0; i < m_columnPurposeCombos.size(); ++i) {
         QComboBox *cb = m_columnPurposeCombos[i];
         if (cb->currentIndex() == int(CSVFormat::ColumnValue)) {
             cb->setCurrentIndex(int(CSVFormat::ColumnStartTime));
@@ -272,7 +274,10 @@
 void
 CSVFormatDialog::removeStartTimePurpose()
 {
-    for (int i = 0; i < m_format.getColumnCount(); ++i) {
+    // NB there may be fewer than m_format.getColumnCount() elements
+    // in m_columnPurposeCombos (because of the fuzzy column
+    // behaviour)
+    for (int i = 0; i < m_columnPurposeCombos.size(); ++i) {
         QComboBox *cb = m_columnPurposeCombos[i];
         if (cb->currentIndex() == int(CSVFormat::ColumnStartTime)) {
             cb->setCurrentIndex(int(CSVFormat::ColumnValue));