diff --git a/src/snapshotmanager.cpp b/src/snapshotmanager.cpp --- a/src/snapshotmanager.cpp +++ b/src/snapshotmanager.cpp @@ -1,5 +1,5 @@ /* - Copyright © 2018 Hasan Yavuz Özderya + Copyright © 2019 Hasan Yavuz Özderya This file is part of serialplot. @@ -71,6 +71,7 @@ Snapshot* SnapshotManager::makeSnapshot( for (unsigned ci = 0; ci < _stream->numChannels(); ci++) { + snapshot->xData.append(new IndexBuffer(_stream->numSamples())); snapshot->yData.append(new ReadOnlyBuffer(_stream->channel(ci)->yData())); } @@ -156,8 +157,16 @@ void SnapshotManager::loadSnapshotFromFi QTextStream ts(&file); QString line; unsigned lineNum = 1; + +#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) while (ts.readLineInto(&line)) { +#else + while (true) + { + line = ts.readLine(); + if (line.isNull()) break; +#endif // parse line auto split = line.split(','); @@ -194,6 +203,7 @@ void SnapshotManager::loadSnapshotFromFi for (unsigned ci = 0; ci < numOfChannels; ci++) { + snapshot->xData.append(new IndexBuffer(data[ci].size())); snapshot->yData.append(new ReadOnlyBuffer(data[ci].data(), data[ci].size())); }