aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-15 07:16:39 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-15 07:16:39 +0200
commite9a9c439d10d6924298884d7d83b60ec41e79dd7 (patch)
tree979fad9aba3474a97cb23b7584618ac2de8d8e02 /sources/shiboken2/generator
parent1b6293860a24299572488fb3cbec31cce93f7276 (diff)
parent48d2fb79774dad5317942fce9deb3e958a6818c5 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Diffstat (limited to 'sources/shiboken2/generator')
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index c771a9c92..73bb70da5 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -3175,7 +3175,10 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
const CodeSnipList &snips = func->injectedCodeSnips();
for (const CodeSnip &cs : snips) {
if (cs.position == TypeSystem::CodeSnipPositionEnd) {
- s << INDENT << "overloadId = " << func->ownerClass()->functions().indexOf(const_cast<AbstractMetaFunction *const>(func)) << ";\n";
+ auto klass = func->ownerClass();
+ s << INDENT << "overloadId = "
+ << klass->functions().indexOf(const_cast<AbstractMetaFunction *>(func))
+ << ";\n";
break;
}
}
@@ -4053,8 +4056,10 @@ void CppGenerator::writeClassDefinition(QTextStream &s,
}
s << INDENT << "{0, " << NULL_PTR << "}\n";
s << "};\n";
+
+ int packageLevel = packageName().count(QLatin1Char('.')) + 1;
s << "static PyType_Spec " << className << "_spec = {\n";
- s << INDENT << "\"" << computedClassTargetFullName << "\",\n";
+ s << INDENT << '"' << packageLevel << ':' << computedClassTargetFullName << "\",\n";
s << INDENT << "sizeof(SbkObject),\n";
s << INDENT << "0,\n";
s << INDENT << tp_flags << ",\n";
@@ -4682,6 +4687,7 @@ void CppGenerator::writeEnumInitialization(QTextStream &s, const AbstractMetaEnu
QString enumVarTypeObj;
if (!cppEnum->isAnonymous()) {
+ int packageLevel = packageName().count(QLatin1Char('.')) + 1;
FlagsTypeEntry *flags = enumTypeEntry->flags();
if (flags) {
// The following could probably be made nicer:
@@ -4689,7 +4695,7 @@ void CppGenerator::writeEnumInitialization(QTextStream &s, const AbstractMetaEnu
QString fullPath = getClassTargetFullName(cppEnum);
fullPath.truncate(fullPath.lastIndexOf(QLatin1Char('.')) + 1);
s << INDENT << cpythonTypeNameExt(flags) << " = PySide::QFlags::create(\""
- << fullPath << flags->flagsName() << "\", "
+ << packageLevel << ':' << fullPath << flags->flagsName() << "\", "
<< cpythonEnumName(cppEnum) << "_number_slots);\n";
}
@@ -4701,7 +4707,7 @@ void CppGenerator::writeEnumInitialization(QTextStream &s, const AbstractMetaEnu
{
Indentation indent(INDENT);
s << INDENT << '"' << cppEnum->name() << "\",\n";
- s << INDENT << '"' << getClassTargetFullName(cppEnum) << "\",\n";
+ s << INDENT << '"' << packageLevel << ':' << getClassTargetFullName(cppEnum) << "\",\n";
s << INDENT << '"' << (cppEnum->enclosingClass() ? (cppEnum->enclosingClass()->qualifiedCppName() + QLatin1String("::")) : QString());
s << cppEnum->name() << '"';
if (flags)