diff data/fileio/CSVFileReader.cpp @ 1030:920699b6989d

Use filename as object name when reading data file to model (so it shows in the resulting layer name)
author Chris Cannam
date Fri, 13 Feb 2015 13:30:28 +0000
parents e369dd281cf2
children cc27f35aa75c
line wrap: on
line diff
--- a/data/fileio/CSVFileReader.cpp	Fri Feb 13 13:29:44 2015 +0000
+++ b/data/fileio/CSVFileReader.cpp	Fri Feb 13 13:30:28 2015 +0000
@@ -26,6 +26,7 @@
 #include "DataFileReaderFactory.h"
 
 #include <QFile>
+#include <QFileInfo>
 #include <QString>
 #include <QRegExp>
 #include <QStringList>
@@ -55,6 +56,7 @@
 
     if (good) {
         m_device = file;
+        m_filename = QFileInfo(path).fileName();
     } else {
 	delete file;
     }
@@ -263,6 +265,12 @@
                     model = model3;
                     break;
                 }
+
+                if (model) {
+                    if (m_filename != "") {
+                        model->setObjectName(m_filename);
+                    }
+                }
             }
 
             float value = 0.f;