]> granicus.if.org Git - graphviz/commitdiff
gvedit MdiChild::saveFile: disable explicit UTF-8 saving with Qt ≥ 6
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 31 Dec 2022 00:20:20 +0000 (16:20 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 31 Dec 2022 17:24:03 +0000 (09:24 -0800)
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

cmd/gvedit/mdichild.cpp

index 3b41ce55c2b65f267e1caf0d23dfa0b0d775de26..c4390fbd97c1b3c93d789987820e2704cef05529 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <memory>
 #include <QtWidgets>
-
+#include <QtGlobal>
 #include "mdichild.h"
 #include "mainwindow.h"
 
@@ -93,7 +93,9 @@ bool MdiChild::saveFile(const QString & fileName)
 
     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();