From e7ad0393b8adce47c6b2ec44c9734453c683df39 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Sun, 8 Oct 2023 10:29:05 -0700 Subject: [PATCH] Qt6: fixes for removal of Qt5 types Also add the alternate types that are available in Qt5 to replace the types deprecated in Qt5.14 (allows Qt5.15LTS users to make changes for compatibility with Qt6.) Signed-off-by: John Bowler --- generator/setupgenerator.cpp | 7 +++++++ generator/shellgenerator.cpp | 7 +++++++ src/PythonQtMethodInfo.cpp | 6 ++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/generator/setupgenerator.cpp b/generator/setupgenerator.cpp index 4694bab3a..6ac50580a 100644 --- a/generator/setupgenerator.cpp +++ b/generator/setupgenerator.cpp @@ -158,7 +158,10 @@ static QSet _builtinListTypes = QSet() << "QByteArray" << "QLineF" << "QPoint" << "QPointF" +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) << "QRegExp" +#endif +<< "QRegularExpression" << "QFont" << "QPixmap" << "QBrush" @@ -175,7 +178,11 @@ static QSet _builtinListTypes = QSet() << "QByteArray" << "QPen" << "QTextLength" << "QTextFormat" +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) << "QMatrix" +#endif +<< "QTransform" +<< "QMatrix4x4" << "QVariant"; static void addListRegistration(AbstractMetaType* type, QSet& output) { diff --git a/generator/shellgenerator.cpp b/generator/shellgenerator.cpp index 959ba344a..d9de72a4b 100644 --- a/generator/shellgenerator.cpp +++ b/generator/shellgenerator.cpp @@ -435,7 +435,11 @@ bool ShellGenerator::isBuiltIn(const QString& name) { builtIn.insert("QKeySequence"); builtIn.insert("QTextLength"); builtIn.insert("QTextFormat"); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) builtIn.insert("QMatrix"); +#endif + builtIn.insert("QTransform"); + builtIn.insert("QMatrix4x4"); builtIn.insert("QDate"); builtIn.insert("QTime"); builtIn.insert("QDateTime"); @@ -449,7 +453,10 @@ bool ShellGenerator::isBuiltIn(const QString& name) { builtIn.insert("QLineF"); builtIn.insert("QPoint"); builtIn.insert("QPointF"); +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) builtIn.insert("QRegExp"); +#endif + builtIn.insert("QRegularExpression"); } return builtIn.contains(name); } diff --git a/src/PythonQtMethodInfo.cpp b/src/PythonQtMethodInfo.cpp index e5b5a41d6..4344be909 100644 --- a/src/PythonQtMethodInfo.cpp +++ b/src/PythonQtMethodInfo.cpp @@ -372,7 +372,7 @@ int PythonQtMethodInfo::nameToType(const char* name) _parameterTypeDict.insert("QLineF", QMetaType::QLineF); _parameterTypeDict.insert("QPoint", QMetaType::QPoint); _parameterTypeDict.insert("QPointF", QMetaType::QPointF); -#if QT_VERSION < 0x060000 +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) _parameterTypeDict.insert("QRegExp", QMetaType::QRegExp); #endif _parameterTypeDict.insert("QRegularExpression", QMetaType::QRegularExpression); @@ -390,9 +390,11 @@ int PythonQtMethodInfo::nameToType(const char* name) _parameterTypeDict.insert("QKeySequence", QMetaType::QKeySequence); _parameterTypeDict.insert("QPen", QMetaType::QPen); _parameterTypeDict.insert("QTextLength", QMetaType::QTextLength); -#if QT_VERSION < 0x060000 +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) _parameterTypeDict.insert("QMatrix", QMetaType::QMatrix); #endif + _parameterTypeDict.insert("QMatrix4x4", QMetaType::QMatrix4x4); + _parameterTypeDict.insert("QTransform", QMetaType::QTransform); _parameterTypeDict.insert("QTextFormat", QMetaType::QTextFormat); _parameterTypeDict.insert("QVariant", PythonQtMethodInfo::Variant); // own special types... (none so far, could be e.g. ObjectList