Add QIODevice::Text for text writing, to convert newlines. Refs #1246

This commit is contained in:
baldurk
2019-01-28 19:55:39 +00:00
parent f8d575d2d1
commit 317e89f7cb
5 changed files with 10 additions and 5 deletions
+6 -1
View File
@@ -3235,7 +3235,12 @@ void BufferViewer::exportData(const BufferExport &params)
QFile *f = new QFile(filename);
if(!f->open(QIODevice::WriteOnly | QFile::Truncate))
QIODevice::OpenMode flags = QIODevice::WriteOnly | QFile::Truncate;
if(params.format == BufferExport::CSV)
flags |= QIODevice::Text;
if(!f->open(flags))
{
delete f;
RDDialog::critical(this, tr("Error exporting file"),
@@ -211,7 +211,7 @@ void ConstantBufferPreviewer::on_saveCSV_clicked()
if(dirinfo.exists())
{
QFile f(filename, this);
if(f.open(QIODevice::WriteOnly | QIODevice::Truncate))
if(f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text))
{
QTextStream ts(&f);
+1 -1
View File
@@ -673,7 +673,7 @@ void EventBrowser::on_exportDraws_clicked()
if(dirinfo.exists())
{
QFile f(filename);
if(f.open(QIODevice::WriteOnly | QIODevice::Truncate))
if(f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text))
{
QTextStream stream(&f);
@@ -306,7 +306,7 @@ void PerformanceCounterViewer::on_saveCSV_clicked()
if(dirinfo.exists())
{
QFile f(filename, this);
if(f.open(QIODevice::WriteOnly | QIODevice::Truncate))
if(f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text))
{
QTextStream ts(&f);
+1 -1
View File
@@ -651,7 +651,7 @@ void PythonShell::on_saveScript_clicked()
if(dirinfo.exists())
{
QFile f(filename);
if(f.open(QIODevice::WriteOnly | QIODevice::Truncate))
if(f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text))
{
f.write(scriptEditor->getText(scriptEditor->textLength() + 1));
}