From Qt6 onwards, `QTextStream` is in UTF-8 by default:¹
By default, QStringConverter::Utf8 is used, and automatic unicode detection
is enabled.
Gitlab: #2233
¹ https://doc.qt.io/qt-6.2/qtextstream.html#setEncoding
#include <memory>
#include <QtWidgets>
-
+#include <QtGlobal>
#include "mdichild.h"
#include "mainwindow.h"
QTextStream out(&file);
QApplication::setOverrideCursor(Qt::WaitCursor);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
+#endif
out << toPlainText();
out.flush();
QApplication::restoreOverrideCursor();