summaryrefslogtreecommitdiffstats
path: root/src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp
diff options
context:
space:
mode:
authorLars Knoll <[email protected]>2020-04-28 13:48:45 +0200
committerLars Knoll <[email protected]>2020-05-01 18:52:14 +0200
commit5acc3dd242cdd82e063e8aac3f7ee6cf76bd8fbd (patch)
treed07bf60cd07cbfd42b97748e70d8bbfad2a2c0f9 /src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp
parenta308df82ae5d0ea22f3d86ee63138b3df48ab2a9 (diff)
Remove a couple of QTextStream usages
Don't use QTextStream to write a QString to a file in UTF-8. This can be done more easily, by directly converting the QString to utf-8 and calling write on the io device. Change-Id: I4b617b342ab339affb396ed49c5a920985d1ddfd Reviewed-by: Thiago Macieira <[email protected]> Reviewed-by: Alex Blasche <[email protected]>
Diffstat (limited to 'src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp')
-rw-r--r--src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp b/src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp
index 849f0e957f2..65f855f977f 100644
--- a/src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp
+++ b/src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp
@@ -154,10 +154,7 @@ bool MainWindow::writeXml(const QString &fileName)
QFile file(fileName);
if (file.open(QFile::WriteOnly)) {
- QTextStream textStream(&file);
- textStream.setCodec(QTextCodec::codecForName("UTF-8"));
-
- textStream << domDocument->toString(1).toUtf8();
+ file.write(domDocument->toString(1).toUtf8());
file.close();
return true;
}