diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-10-22 11:09:18 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-11-10 16:13:05 +0100 |
commit | 2375cf516fa213ab92daa7f1b0665b0f6c6407bf (patch) | |
tree | 51ae8fff0062439a22238a2761f47ec4a840f732 | |
parent | 216319f83d33b0287a14a9de5512859946e11626 (diff) |
shiboken6: Remove ShibokenGenerator::guessScopeForDefaultValue()
Move resolving of class fields and enum values as argument default
values into AbstractMetaBuilder.
Handling of static class field constants was spread between
AbstractMetaBuilderPrivate::fixDefaultValue() and
ShibokenGenerator::guessScopeForDefaultValue().
The former was handling it for arguments of non-primitive type only
and not completely expanding namespaces. The latter was handling it
for arguments of primitive types, too, but also added some code for
non-static fields, which cannot be used as default arguments in C++.
ShibokenGenerator::guessScopeForDefaultValue() was handling enum
values for primitive and values, excluding macros by regex, but
otherwise not checking if the term is really an enum value.
Rewrite the code in AbstractMetaBuilderPrivate::fixDefaultValue()
without regexes for clarity, let it check fields and
enum values correctly via code model and fully expand namespaces.
Add tests.
Adapt the signature module to the now fully qualified signatures.
[ChangeLog][shiboken6] When qualifying function argument default
values for the generated code, shiboken no longer considers each
identifier it cannot otherwise find as an enum value and no longer
adds the class scope to it. This may require manually adding some
replace-default-expression modifications.
Task-number: PYSIDE-1691
Change-Id: Id4cd2ca1f91db8c1663d7fc31e4b4ef72a5690f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Tismer <tismer@stackless.com>
(cherry picked from commit 2a7f16dccfa1986bb79d08c90ed2ef56133994e8)
10 files changed, 165 insertions, 117 deletions
diff --git a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml index 01a43b519..7d66b1064 100644 --- a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml +++ b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml @@ -813,6 +813,7 @@ <object-type name="SystemId"/> <!-- not default-constructible --> <value-type name="YearMonthDay"/> <enum-type name="System"/> + <enum-type identified-by-value="Unspecified"/> </value-type> <value-type name="QDate" hash-function="PySide::hash" > <inject-code class="native" position="beginning"> diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp index b46b60fee..e92a32407 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp @@ -769,6 +769,8 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseNamespace(const FileModel if (mjc) { metaClass->addInnerClass(mjc); mjc->setEnclosingClass(metaClass); + m_classToItem.insert(mjc, ni.data()); // Add for enum lookup. + m_itemToClass.insert(ni.data(), mjc); } } @@ -2537,6 +2539,26 @@ void AbstractMetaBuilder::setCodeModelTestMode(bool b) AbstractMetaBuilderPrivate::m_codeModelTestMode = b; } +// Helper to fix a simple default value (field or enum reference) in a +// class context. +QString AbstractMetaBuilderPrivate::fixSimpleDefaultValue(QStringView expr, + const AbstractMetaClass *klass) const +{ + const QString field = qualifyStaticField(klass, expr); + + if (!field.isEmpty()) + return field; + const auto cit = m_classToItem.constFind(klass); + if (cit == m_classToItem.cend()) + return {}; + auto *scope = dynamic_cast<const _ScopeModelItem *>(cit.value()); + if (!scope) + return {}; + if (auto enumValue = scope->findEnumByValue(expr)) + return enumValue.qualifiedName; + return {}; +} + // see TestResolveType::testFixDefaultArguments() QString AbstractMetaBuilderPrivate::fixDefaultValue(QString expr, const AbstractMetaType &type, const AbstractMetaClass *implementingClass) const @@ -2569,39 +2591,53 @@ QString AbstractMetaBuilderPrivate::fixDefaultValue(QString expr, const Abstract if (isUnderQualifiedSpec(qualifiedInnerTypeName, innerType)) expr.replace(innerPos, innerLen, qualifiedInnerTypeName); } else { - // Here the default value is supposed to be a constructor, - // a class field, or a constructor receiving a class field - static const QRegularExpression defaultRegEx(QStringLiteral("([^\\(]*\\(|)([^\\)]*)(\\)|)")); - Q_ASSERT(defaultRegEx.isValid()); - const QRegularExpressionMatch defaultMatch = defaultRegEx.match(expr); - QString defaultValueCtorName = defaultMatch.hasMatch() ? defaultMatch.captured(1) : QString(); - if (defaultValueCtorName.endsWith(QLatin1Char('('))) - defaultValueCtorName.chop(1); - - // Fix the scope for constructor using the already resolved argument - // type as a reference. The following regular expression extracts any - // use of namespaces/scopes from the type string. - static const QRegularExpression - typeRegEx(QLatin1String(R"(^(?:const[\s]+|)([\w:]*::|)([A-Za-z_]\w*)\s*[&\*]?$)")); - Q_ASSERT(typeRegEx.isValid()); - const QRegularExpressionMatch typeMatch = typeRegEx.match(type.minimalSignature()); - - QString typeNamespace = typeMatch.hasMatch() ? typeMatch.captured(1) : QString(); - QString typeCtorName = typeMatch.hasMatch() ? typeMatch.captured(2) : QString(); - if (!typeNamespace.isEmpty() && defaultValueCtorName == typeCtorName) - expr.prepend(typeNamespace); - - // Fix scope if the parameter is a field of the current class - if (implementingClass) { - const AbstractMetaFieldList &fields = implementingClass->fields(); - for (const AbstractMetaField &field : fields) { - if (defaultMatch.hasMatch() && defaultMatch.captured(2) == field.name()) { - expr = defaultMatch.captured(1) + implementingClass->name() - + colonColon() + defaultMatch.captured(2) + defaultMatch.captured(3); - break; - } + // Here the default value is supposed to be a constructor, a class field, + // a constructor receiving a static class field or an enum. Consider + // class QSqlDatabase { ... + // static const char *defaultConnection; + // QSqlDatabase(const QString &connection = QLatin1String(defaultConnection)) + // -> = QLatin1String(QSqlDatabase::defaultConnection) + // static void foo(QSqlDatabase db = QSqlDatabase(defaultConnection)); + // -> = QSqlDatabase(QSqlDatabase::defaultConnection) + // + // Enum values from the class as defaults of int and others types (via + // implicit conversion) are handled here as well: + // class QStyleOption { ... + // enum StyleOptionType { Type = SO_Default }; + // QStyleOption(..., int type = SO_Default); + // -> = QStyleOption::StyleOptionType::SO_Default + + // Is this a single field or an enum? + if (isQualifiedCppIdentifier(expr)) { + const QString fixed = fixSimpleDefaultValue(expr, implementingClass); + return fixed.isEmpty() ? expr : fixed; + } + + // Is this sth like "QLatin1String(field)", "Class(Field)", "Class()"? + const auto parenPos = expr.indexOf(u'('); + if (parenPos == -1 || !expr.endsWith(u')')) + return expr; + // Is the term within parentheses a class field or enum? + const auto innerLength = expr.size() - parenPos - 2; + if (innerLength > 0) { // Not some function call "defaultFunc()" + const auto inner = QStringView{expr}.mid(parenPos + 1, innerLength); + if (isQualifiedCppIdentifier(inner) + && !AbstractMetaBuilder::dontFixDefaultValue(inner)) { + const QString replacement = fixSimpleDefaultValue(inner, implementingClass); + if (!replacement.isEmpty() && replacement != inner) + expr.replace(parenPos + 1, innerLength, replacement); } } + // Is this a class constructor "Class(Field)"? Expand it. + auto *te = type.typeEntry(); + if (!te->isComplex()) + return expr; + const QString &qualifiedTypeName = te->qualifiedCppName(); + if (!qualifiedTypeName.contains(u"::")) // Nothing to qualify here + return expr; + const auto className = QStringView{expr}.left(parenPos); + if (isUnderQualifiedSpec(qualifiedTypeName, className)) + expr.replace(0, className.size(), qualifiedTypeName); } return expr; diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder_helpers.cpp b/sources/shiboken6/ApiExtractor/abstractmetabuilder_helpers.cpp index 33b2cab5f..3db29b6fc 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetabuilder_helpers.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder_helpers.cpp @@ -29,6 +29,7 @@ #include "abstractmetabuilder.h" #include "abstractmetabuilder_p.h" #include "abstractmetaenum.h" +#include "abstractmetafield.h" #include "abstractmetalang.h" #include "typesystem.h" @@ -79,7 +80,7 @@ static QString resolveEnumValueScopePrefix(const AbstractMetaEnum &metaEnum, return resolveScopePrefixHelper(parts, value); } -static bool isQualifiedCppIdentifier(QStringView e) +bool AbstractMetaBuilderPrivate::isQualifiedCppIdentifier(QStringView e) { return !e.isEmpty() && e.at(0).isLetter() && std::all_of(e.cbegin() + 1, e.cend(), @@ -197,3 +198,22 @@ bool AbstractMetaBuilder::dontFixDefaultValue(QStringView expr) || expr.startsWith(u"Qt::") // Qt namespace constant || isIntegerConstant(expr) || isFloatConstant(expr); } + +QString AbstractMetaBuilderPrivate::qualifyStaticField(const AbstractMetaClass *c, + QStringView field) +{ + if (!c || c->fields().isEmpty()) + return {}; + // If there is a scope, ensure it matches the class + const auto lastQualifier = field.lastIndexOf(u"::"); + if (lastQualifier != -1 + && !c->qualifiedCppName().endsWith(field.left(lastQualifier))) { + return {}; + } + const auto fieldName = lastQualifier != -1 + ? field.mid(lastQualifier + 2) : field; + const auto fieldOpt = c->findField(fieldName); + if (!fieldOpt.has_value() || !fieldOpt.value().isStatic()) + return {}; + return AbstractMetaBuilder::resolveScopePrefix(c, field) + field.toString(); +} diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder_p.h b/sources/shiboken6/ApiExtractor/abstractmetabuilder_p.h index cb835e201..7a6d4a7a1 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetabuilder_p.h +++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder_p.h @@ -149,9 +149,15 @@ public: static void setupFunctionDefaults(AbstractMetaFunction *metaFunction, AbstractMetaClass *metaClass); + static bool isQualifiedCppIdentifier(QStringView e); QString fixDefaultValue(QString expr, const AbstractMetaType &type, const AbstractMetaClass *) const; + QString fixSimpleDefaultValue(QStringView expr, + const AbstractMetaClass *klass) const; + QString fixEnumDefault(const AbstractMetaType &type, const QString &expr) const; + /// Qualify a static field name for default value expressions + static QString qualifyStaticField(const AbstractMetaClass *c, QStringView field); std::optional<AbstractMetaType> translateType(const TypeInfo &type, const AbstractMetaClass *currentClass, diff --git a/sources/shiboken6/ApiExtractor/tests/testresolvetype.cpp b/sources/shiboken6/ApiExtractor/tests/testresolvetype.cpp index 809e3b824..4abcb9d4f 100644 --- a/sources/shiboken6/ApiExtractor/tests/testresolvetype.cpp +++ b/sources/shiboken6/ApiExtractor/tests/testresolvetype.cpp @@ -34,6 +34,12 @@ #include <abstractmetatype.h> #include <typesystem.h> +void TestResolveType::initTestCase() +{ + // For enum lookup in testFixDefaultArguments() + AbstractMetaBuilder::setCodeModelTestMode(true); +} + void TestResolveType::testResolveReturnTypeFromParentScope() { const char* cppCode = "\n\ @@ -93,6 +99,8 @@ namespace Namespace { class Test { public: + enum Enum { enumValue1, enumValue2 }; + explicit Test(int x = INT_FIELD_1); explicit Test(const std::string &t = std::string(CHAR_FIELD_1)); @@ -109,7 +117,9 @@ public: <primitive-type name='char'/> <primitive-type name='std::string'/> <namespace-type name='Namespace'> - <value-type name='Test'/> + <value-type name='Test'> + <enum-type name='Enum'/> + </value-type> </namespace-type> <container-type name="std::list" type="list"/> </typesystem> @@ -165,6 +175,10 @@ void TestResolveType::testFixDefaultArguments_data() QTest::newRow("int") << fixture << setupOk << fixture.intType << "1" << "1"; + QTest::newRow("int-macro") << fixture << setupOk + << fixture.intType << "GL_MACRO" << "GL_MACRO"; + QTest::newRow("int-enum") << fixture << setupOk + << fixture.intType << "enumValue1" << "Namespace::Test::Enum::enumValue1"; // Test expansion of container types QString expected = u"std::list<Namespace::Test>()"_qs; @@ -174,6 +188,51 @@ void TestResolveType::testFixDefaultArguments_data() QTest::newRow("partially qualified list") << fixture << setupOk << fixture.listType << "std::list<Test>()" << expected; + + // Test field expansion + expected = u"Namespace::Test::INT_FIELD_1"_qs; + QTest::newRow("qualified class field") + << fixture << setupOk << fixture.intType + << expected << expected; + QTest::newRow("partially qualified class field") + << fixture << setupOk << fixture.intType + << "Test::INT_FIELD_1" << expected; + QTest::newRow("unqualified class field") + << fixture << setupOk << fixture.intType + << "INT_FIELD_1" << expected; + + // Test field expansion when constructing some class + expected = u"QLatin1String(Namespace::Test::CHAR_FIELD_1)"_qs; + QTest::newRow("class from qualified class field") + << fixture << setupOk << fixture.classType + << expected << expected; + QTest::newRow("class from partially qualified class field") + << fixture << setupOk << fixture.classType + << "QLatin1String(Test::CHAR_FIELD_1)" << expected; + QTest::newRow("class from unqualified class field") + << fixture << setupOk << fixture.classType + << "QLatin1String(CHAR_FIELD_1)" << expected; + + // Test field expansion when constructing class itself + expected = u"Namespace::Test(Namespace::Test::CHAR_FIELD_1)"_qs; + QTest::newRow("self from qualified class field") + << fixture << setupOk << fixture.classType + << expected << expected; + QTest::newRow("self from partially qualified class field") + << fixture << setupOk << fixture.classType + << "Test(Test::CHAR_FIELD_1)" << expected; + QTest::newRow("self from unqualified class field") + << fixture << setupOk << fixture.classType + << "Test(CHAR_FIELD_1)" << expected; + + // Test enum expansion when constructing class itself + expected = u"Namespace::Test(Namespace::Test::Enum::enumValue1)"_qs; + QTest::newRow("self from qualified enum") + << fixture << setupOk << fixture.classType + << expected << expected; + QTest::newRow("self from enum") + << fixture << setupOk << fixture.classType + << "Test(enumValue1)" << expected; } void TestResolveType::testFixDefaultArguments() diff --git a/sources/shiboken6/ApiExtractor/tests/testresolvetype.h b/sources/shiboken6/ApiExtractor/tests/testresolvetype.h index 1c6f654d0..0263ff2b0 100644 --- a/sources/shiboken6/ApiExtractor/tests/testresolvetype.h +++ b/sources/shiboken6/ApiExtractor/tests/testresolvetype.h @@ -35,6 +35,8 @@ class TestResolveType : public QObject { Q_OBJECT private slots: + void initTestCase(); + void testResolveReturnTypeFromParentScope(); void testFixDefaultArguments_data(); void testFixDefaultArguments(); diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp index 1d0f314a6..aacbd8240 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp +++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp @@ -3036,7 +3036,7 @@ void CppGenerator::writeSingleFunctionCall(TextStream &s, const QString cppArgRemoved = QLatin1String(CPP_ARG_REMOVED) + QString::number(argIdx); s << getFullTypeName(arg.type()) << ' ' << cppArgRemoved; - s << " = " << guessScopeForDefaultValue(func, arg) << ";\n"; + s << " = " << arg.defaultValueExpression() << ";\n"; writeUnusedVariableCast(s, cppArgRemoved); } else if (!injectCodeCallsFunc && !func->isUserAdded() && !hasConversionRule) { // When an argument is removed from a method signature and no other means of calling @@ -3058,9 +3058,8 @@ void CppGenerator::writeSingleFunctionCall(TextStream &s, int argPos = argIdx - removedArgs; QString argName = QLatin1String(CPP_ARG) + QString::number(argPos); QString pyArgName = usePyArgs ? pythonArgsAt(argPos) : QLatin1String(PYTHON_ARG); - QString defaultValue = guessScopeForDefaultValue(func, arg); writeArgumentConversion(s, argType, argName, pyArgName, - func->implementingClass(), defaultValue, + func->implementingClass(), arg.defaultValueExpression(), func->isUserAdded()); } diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp index 680c7248e..a8c79ecb2 100644 --- a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp +++ b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp @@ -364,76 +364,6 @@ static QString cpythonEnumFlagsName(const QString &moduleName, return result; } -/* - * This function uses some heuristics to find out the scope for a given - * argument default value since they must be fully qualified when used outside the class: - * class A { - * enum Enum { e1, e1 }; - * void foo(Enum e = e1); - * } - * should be qualified to: - * A::Enum cppArg0 = A::Enum::e1; - * - * New situations may arise in the future and - * this method should be updated, do it with care. - */ -QString ShibokenGenerator::guessScopeForDefaultValue(const AbstractMetaFunctionCPtr &func, - const AbstractMetaArgument &arg) const -{ - QString value = arg.defaultValueExpression(); - - if (arg.hasModifiedDefaultValueExpression() - || arg.type().isPointer() - || AbstractMetaBuilder::dontFixDefaultValue(value)) { - return value; - } - - static const QRegularExpression enumValueRegEx(QStringLiteral("^([A-Za-z_]\\w*)?$")); - Q_ASSERT(enumValueRegEx.isValid()); - // Do not qualify macros by class name, eg QSGGeometry(..., int t = GL_UNSIGNED_SHORT); - static const QRegularExpression macroRegEx(QStringLiteral("^[A-Z_][A-Z0-9_]*$")); - Q_ASSERT(macroRegEx.isValid()); - if (arg.type().isPrimitive() && macroRegEx.match(value).hasMatch()) - return value; - - QString prefix; - if (arg.type().isEnum() || arg.type().isFlags()) { - // handled by AbstractMetaBuilder::fixEnumDefault() - } else if (arg.type().typeEntry()->isValue()) { - auto metaClass = AbstractMetaClass::findClass(api().classes(), - arg.type().typeEntry()); - if (enumValueRegEx.match(value).hasMatch()) - prefix = AbstractMetaBuilder::resolveScopePrefix(metaClass, value); - } else if (arg.type().isPrimitive() && arg.type().name() == intT()) { - if (enumValueRegEx.match(value).hasMatch() && func->implementingClass()) - prefix = AbstractMetaBuilder::resolveScopePrefix(func->implementingClass(), value); - } else if (arg.type().isPrimitive()) { - static const QRegularExpression unknowArgumentRegEx(QStringLiteral("^(?:[A-Za-z_][\\w:]*\\()?([A-Za-z_]\\w*)(?:\\))?$")); // [PrimitiveType(] DESIREDNAME [)] - Q_ASSERT(unknowArgumentRegEx.isValid()); - const QRegularExpressionMatch match = unknowArgumentRegEx.match(value); - if (match.hasMatch() && func->implementingClass()) { - for (const AbstractMetaField &field : func->implementingClass()->fields()) { - if (match.captured(1).trimmed() == field.name()) { - QString fieldName = field.name(); - if (field.isStatic()) { - prefix = AbstractMetaBuilder::resolveScopePrefix(func->implementingClass(), value); - fieldName.prepend(prefix); - prefix.clear(); - } else { - fieldName.prepend(QLatin1String(CPP_SELF_VAR) + QLatin1String("->")); - } - value.replace(match.captured(1), fieldName); - break; - } - } - } - } - - if (!prefix.isEmpty()) - value.prepend(prefix); - return value; -} - QString ShibokenGenerator::cpythonEnumName(const EnumTypeEntry *enumEntry) { QString p = enumEntry->targetLangPackage(); diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.h b/sources/shiboken6/generator/shiboken/shibokengenerator.h index afa733bd2..ca2b7fcdc 100644 --- a/sources/shiboken6/generator/shiboken/shibokengenerator.h +++ b/sources/shiboken6/generator/shiboken/shibokengenerator.h @@ -283,10 +283,6 @@ protected: const QString &argName); static QString cpythonWrapperCPtr(const TypeEntry *type, const QString &argName); - /// Guesses the scope to where belongs an argument's default value. - QString guessScopeForDefaultValue(const AbstractMetaFunctionCPtr &func, - const AbstractMetaArgument &arg) const; - static QString cpythonEnumName(const EnumTypeEntry *enumEntry); static QString cpythonEnumName(const AbstractMetaEnum &metaEnum); diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py index ef2c00179..882132650 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py @@ -306,7 +306,6 @@ type_map.update({ "unsigned long": int, "unsigned short int": int, # 5.6, RHEL 6.6 "unsigned short": int, - "Unspecified": None, "ushort": int, "void": int, # be more specific? "WId": WId, @@ -502,6 +501,7 @@ def init_PySide6_QtCore(): PySide6.QtCore.QUrl.ComponentFormattingOption, # mismatch option/enum, why??? "PyUnicode": typing.Text, "Q_NULLPTR": None, + "QCalendar.Unspecified": PySide6.QtCore.QCalendar.Unspecified, "QDir.Filters(AllEntries | NoDotAndDotDot)": Instance( "QDir.Filters(QDir.AllEntries | QDir.NoDotAndDotDot)"), "QDir.SortFlags(Name | IgnoreCase)": Instance( @@ -577,12 +577,11 @@ def init_PySide6_QtWidgets(): "QMessageBox.StandardButtons(QMessageBox.Yes | QMessageBox.No)"), "QWidget.RenderFlags(DrawWindowBackground | DrawChildren)": Instance( "QWidget.RenderFlags(QWidget.DrawWindowBackground | QWidget.DrawChildren)"), - "SH_Default": QStyleHintReturn.SH_Default, - "SO_Complex": QStyleOptionComplex.SO_Complex, - "SO_Default": QStyleOption.SO_Default, "static_cast<Qt.MatchFlags>(Qt.MatchExactly|Qt.MatchCaseSensitive)": Instance( "Qt.MatchFlags(Qt.MatchExactly | Qt.MatchCaseSensitive)"), - "Type": PySide6.QtWidgets.QListWidgetItem.Type, + "QListWidgetItem.ItemType.Type": PySide6.QtWidgets.QListWidgetItem.Type, + "QTableWidgetItem.ItemType.Type": PySide6.QtWidgets.QTableWidgetItem.Type, + "QTreeWidgetItem.ItemType.Type": PySide6.QtWidgets.QTreeWidgetItem.Type, }) return locals() @@ -590,7 +589,7 @@ def init_PySide6_QtWidgets(): def init_PySide6_QtSql(): from PySide6.QtSql import QSqlDatabase type_map.update({ - "QLatin1String(defaultConnection)": QSqlDatabase.defaultConnection, + "QLatin1String(QSqlDatabase.defaultConnection)": QSqlDatabase.defaultConnection, "QVariant.Invalid": Invalid("Variant"), # not sure what I should create, here... }) return locals() @@ -649,7 +648,7 @@ def init_PySide6_QtQuick(): type_map.update({ "PySide6.QtQuick.QSharedPointer[PySide6.QtQuick.QQuickItemGrabResult]": PySide6.QtQuick.QQuickItemGrabResult, - "UnsignedShortType": int, + "QSGGeometry.Type.UnsignedShortType": int, }) return locals() |