From 5acc3dd242cdd82e063e8aac3f7ee6cf76bd8fbd Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 28 Apr 2020 13:48:45 +0200 Subject: 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 Reviewed-by: Alex Blasche --- src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp') diff --git a/src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp b/src/gui/doc/snippets/textdocument-blocks/mainwindow.cpp index 849f0e957f..65f855f977 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; } -- cgit v1.2.1