From 5df5cbb793623813254e60b35ec905dbf62248e5 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Mon, 9 Oct 2023 00:27:44 -0700 Subject: [PATCH] Qt6: generator/typesystem.cpp: XML workround (#123) - works around the need to rewrite the XML parser in generator/typesystem.cpp by invoking the Qt5 compatibility library; this is the only thing in the generator which requires it but the alternative is a complete rewrite of the XML reading code --- generator/generator.pri | 5 +++++ generator/typesystem.cpp | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/generator/generator.pri b/generator/generator.pri index e399d59e3..c941f879b 100644 --- a/generator/generator.pri +++ b/generator/generator.pri @@ -70,6 +70,11 @@ SOURCES += \ QT += core xml +greaterThan(QT_MAJOR_VERSION, 5) { + QT += core5compat + message("WARNING: Qt module core5compat for XML handling in typesystem.cpp") +} + win32-msvc.net { QMAKE_CXXFLAGS += /Zm500 QMAKE_CXXFLAGS -= -Zm200 diff --git a/generator/typesystem.cpp b/generator/typesystem.cpp index ea9b455be..c3f6ded94 100644 --- a/generator/typesystem.cpp +++ b/generator/typesystem.cpp @@ -51,6 +51,22 @@ #include #include // Q_FALLTHROUGH +/* This file needs to be rewritten as documented here: + * + * See: https://doc.qt.io/qt-6/xml-changes-qt6.html + * + * The rewrite may be backward compatible to Qt4.3 APIs because the base + * facilites (QXmlStreamReader) used to relace the 'SAX' parser were apparently + * available then. Use of Xml5Compat is a work round until such a rewrite has + * been done. + */ +#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) +# if defined(__GNUC__) +# pragma GCC warning "Qt6: implement Qt6 compatible XML reading" +# endif +# include +#endif + QString strings_Object = QLatin1String("Object"); QString strings_String = QLatin1String("String"); QString strings_Thread = QLatin1String("Thread");