-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtools.cpp
More file actions
33 lines (30 loc) · 799 Bytes
/
tools.cpp
File metadata and controls
33 lines (30 loc) · 799 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
#include "tools.h"
Tools::Tools()
{
}
QString Tools::openTextFile(const QString &filename){
QFile file(filename);
if (!file.open(QIODevice::ReadOnly)){
qWarning() << "WARNING: file not opened \"" + filename + "\"";
return QString();
}
QTextStream out(&file);
return out.readAll();
}
/*
QByteArray MainWindow::openFileAsByteArray(const QString& fileName){
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)){
QMessageBox::information(this, "Unable to open file", file.errorString());
return "";
}
QByteArray content, chunk;
QTextStream out(&file);
do {
out >> chunk;
content.append(chunk);
} while (!chunk.isEmpty());
//qDebug() << content;
return content;
return QByteArray();
}*/