-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilemanager.h
More file actions
55 lines (36 loc) · 899 Bytes
/
filemanager.h
File metadata and controls
55 lines (36 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef FILEMANAGER_H
#define FILEMANAGER_H
#include <QObject>
#include <QLineSeries>
#include <QFile>
#include <QTextStream>
#include <QPointF>
class FileManager : public QObject
{
public:
explicit FileManager(QObject *parent = nullptr);
QList<QPointF> loadSpectrum(const QString &);
private:
signals:
public slots:
};
inline FileManager::FileManager(QObject *parent){
Q_UNUSED(parent);
}
inline QList<QPointF> FileManager::loadSpectrum(const QString &filePath)
{
QString line;
QList<QPointF> spectrumData;
int iter = 0;
QFile file(filePath);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&file);
while (!in.atEnd()) {
line = in.readLine();
spectrumData.append(QPointF(iter++, line.toInt()));
}
file.close();
}
return spectrumData;
}
#endif // FILEMANAGER_H