changeset 32051:17a09d2bbe0f

gui: Remove usage of QTextCodec from some more places. * libgui/src/gui-preference.h: Remove unused header. * libgui/src/octave-qobject.cc: Include header only if function from it are used. * m4/acinclude.m4: Do not require Qt6Core5Compat on platforms that don't need it.
author Markus Mützel <markus.muetzel@gmx.de>
date Sun, 23 Apr 2023 11:08:16 +0200
parents c00d842608f7
children d77b987a7e0d
files libgui/src/gui-preferences.h libgui/src/octave-qobject.cc m4/acinclude.m4
diffstat 3 files changed, 17 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/gui-preferences.h	Sat Apr 22 20:59:48 2023 +0200
+++ b/libgui/src/gui-preferences.h	Sun Apr 23 11:08:16 2023 +0200
@@ -31,7 +31,6 @@
 #include <QStringList>
 #include <QStyle>
 #include <QTabWidget>
-#include <QTextCodec>
 #include <QVariant>
 
 // FIXME: Would it be possible/make sense to merge gui_pref and sc_pref
--- a/libgui/src/octave-qobject.cc	Sat Apr 22 20:59:48 2023 +0200
+++ b/libgui/src/octave-qobject.cc	Sun Apr 23 11:08:16 2023 +0200
@@ -32,7 +32,9 @@
 #include <QApplication>
 #include <QClipboard>
 #include <QFile>
-#include <QTextCodec>
+#if ! defined (Q_OS_WIN32)
+#  include <QTextCodec>
+#endif
 #include <QThread>
 #include <QTimer>
 #include <QTranslator>
@@ -198,8 +200,8 @@
   if (show_gui_msgs.empty ())
     qInstallMessageHandler (message_handler);
 
+#if ! defined (Q_OS_WIN32)
   // Set the codec for all strings (before wizard or any GUI object)
-#if ! defined (Q_OS_WIN32)
   QTextCodec::setCodecForLocale (QTextCodec::codecForName ("UTF-8"));
 #endif
 
--- a/m4/acinclude.m4	Sat Apr 22 20:59:48 2023 +0200
+++ b/m4/acinclude.m4	Sun Apr 23 11:08:16 2023 +0200
@@ -1981,10 +1981,19 @@
       QT_MODULES="Qt5Core Qt5Gui Qt5Help Qt5Network Qt5OpenGL Qt5PrintSupport Qt5Xml"
     ;;
     6)
-      # FIXME: Remove Qt6Core5Compat when we no longer rely on classes that
-      #        have been removed in Qt6:
-      #        https://www.qt.io/blog/porting-from-qt-5-to-qt-6-using-qt5compat-library
-      QT_MODULES="Qt6Core Qt6Core5Compat Qt6Gui Qt6Help Qt6Network Qt6OpenGL Qt6OpenGLWidgets Qt6PrintSupport Qt6Xml"
+      QT_MODULES="Qt6Core Qt6Gui Qt6Help Qt6Network Qt6OpenGL Qt6OpenGLWidgets Qt6PrintSupport Qt6Xml"
+      case $host_os in
+        mingw* | msdosmsvc*)
+        ;;
+        *)
+          # FIXME: Remove Qt6Core5Compat when we no longer rely on classes that
+          #        have been removed in Qt6:
+          #        https://www.qt.io/blog/porting-from-qt-5-to-qt-6-using-qt5compat-library
+          #        It is still needed for the terminal implementation in
+          #        libgui/qterminal/libqterminal/unix
+          QT_MODULES="$QT_MODULES Qt6Core5Compat"
+        ;;
+      esac
     ;;
     *)
       AC_MSG_ERROR([Unrecognized Qt version $qt_version])