summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-05-31 15:54:55 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-05-31 15:55:10 (GMT)
commit9d89c9af4619ef7a49286c3f5cfb5ff7c413d87a (patch)
tree47727b52d314321620f7995e07014eb9c94ff3fc /Source/QtDialog
parentfa21bd9527cd39ecdd0d1cbc8d66461b3321c513 (diff)
parentae13524e3bc116d38fb54770a40e89ae7274540f (diff)
downloadCMake-9d89c9af4619ef7a49286c3f5cfb5ff7c413d87a.zip
CMake-9d89c9af4619ef7a49286c3f5cfb5ff7c413d87a.tar.gz
CMake-9d89c9af4619ef7a49286c3f5cfb5ff7c413d87a.tar.bz2
Merge topic 'cmake-gui-locale'
ae13524e3b cmake-gui: Restore support for internationalization with Qt5 on Windows Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7303
Diffstat (limited to 'Source/QtDialog')
-rw-r--r--Source/QtDialog/CMakeSetup.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 8ffa3e7..c556049 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -10,6 +10,15 @@
#include <QTranslator>
#include <QtPlugin>
+// FIXME(#23565): Qt6 has QTextCodec in Core5Compat, but using its
+// `setCodecForLocale` does not make cmake-gui support non-ASCII chars
+// on Windows. For now we only support them with Qt5. How do we support
+// them with Qt6, preferably without Core5Compat?
+#if defined(Q_OS_WIN) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
+# include <QTextCodec>
+# define CMAKE_HAVE_QTEXTCODEC
+#endif
+
#include "cmsys/CommandLineArguments.hxx"
#include "cmsys/Encoding.hxx"
#include "cmsys/SystemTools.hxx"
@@ -124,6 +133,11 @@ int main(int argc, char** argv)
setlocale(LC_NUMERIC, "C");
+#ifdef CMAKE_HAVE_QTEXTCODEC
+ QTextCodec* utf8_codec = QTextCodec::codecForName("UTF-8");
+ QTextCodec::setCodecForLocale(utf8_codec);
+#endif
+
// tell the cmake library where cmake is
QDir cmExecDir(QApplication::applicationDirPath());
#if defined(Q_OS_MAC)