Changeset - 921170ff88f1
[Not reviewed]
Hasan Yavuz Ă–ZDERYA - 10 years ago 2016-04-03 15:18:19
hy@ozderya.net
fix crash when opening snapshot loaded from file, read channel names from the file
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/snapshotmanager.cpp
Show inline comments
 
@@ -144,13 +144,14 @@ void SnapshotManager::loadSnapshotFromFi
 
        qCritical() << file.errorString();
 
        return;
 
    }
 

	
 
    // read first row as headlines and determine number of channels
 
    auto headLine = QString(file.readLine());
 
    unsigned numOfChannels = headLine.split(',').size();
 
    QStringList channelNames = headLine.split(',');
 
    unsigned numOfChannels = channelNames.size();
 

	
 
    // read data
 
    QVector<QVector<QPointF>> data(numOfChannels);
 
    unsigned lineNum = 1;
 
    while (file.canReadLine())
 
    {
 
@@ -182,12 +183,13 @@ void SnapshotManager::loadSnapshotFromFi
 
        }
 
        lineNum++;
 
    }
 

	
 
    auto snapshot = new Snapshot(_mainWindow, QFileInfo(fileName).baseName());
 
    snapshot->data = data;
 
    snapshot->setChannelNames(channelNames);
 

	
 
    addSnapshot(snapshot, false);
 
}
 

	
 
QMenu* SnapshotManager::menu()
 
{
0 comments (0 inline, 0 general)