Skip to content

Commit

Permalink
Qt6: fixes for removal of Qt5 types (#127)
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
jbowler authored and mrbean-bremen committed Oct 29, 2023
1 parent a4cafc5 commit 901122b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
7 changes: 7 additions & 0 deletions generator/setupgenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ static QSet<QString> _builtinListTypes = QSet<QString>() << "QByteArray"
<< "QLineF"
<< "QPoint"
<< "QPointF"
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
<< "QRegExp"
#endif
<< "QRegularExpression"
<< "QFont"
<< "QPixmap"
<< "QBrush"
Expand All @@ -175,7 +178,11 @@ static QSet<QString> _builtinListTypes = QSet<QString>() << "QByteArray"
<< "QPen"
<< "QTextLength"
<< "QTextFormat"
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
<< "QMatrix"
#endif
<< "QTransform"
<< "QMatrix4x4"
<< "QVariant";

static void addListRegistration(AbstractMetaType* type, QSet<QString>& output) {
Expand Down
7 changes: 7 additions & 0 deletions generator/shellgenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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);
}
Expand Down
6 changes: 4 additions & 2 deletions src/PythonQtMethodInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit 901122b

Please sign in to comment.