Skip to content

Commit db96e3c

Browse files
authored
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
1 parent db04231 commit db96e3c

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

generator/generator.pri

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ SOURCES += \
7070

7171
QT += core xml
7272

73+
greaterThan(QT_MAJOR_VERSION, 5) {
74+
QT += core5compat
75+
message("WARNING: Qt module core5compat for XML handling in typesystem.cpp")
76+
}
77+
7378
win32-msvc.net {
7479
QMAKE_CXXFLAGS += /Zm500
7580
QMAKE_CXXFLAGS -= -Zm200

generator/typesystem.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,22 @@
5151
#include <QtXml>
5252
#include <qcompilerdetection.h> // Q_FALLTHROUGH
5353

54+
/* This file needs to be rewritten as documented here:
55+
*
56+
* See: https://doc.qt.io/qt-6/xml-changes-qt6.html
57+
*
58+
* The rewrite may be backward compatible to Qt4.3 APIs because the base
59+
* facilites (QXmlStreamReader) used to relace the 'SAX' parser were apparently
60+
* available then. Use of Xml5Compat is a work round until such a rewrite has
61+
* been done.
62+
*/
63+
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
64+
# if defined(__GNUC__)
65+
# pragma GCC warning "Qt6: implement Qt6 compatible XML reading"
66+
# endif
67+
# include <QtCore5Compat/QXmlDefaultHandler>
68+
#endif
69+
5470
QString strings_Object = QLatin1String("Object");
5571
QString strings_String = QLatin1String("String");
5672
QString strings_Thread = QLatin1String("Thread");

0 commit comments

Comments
 (0)