aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/shiboken2/generator/generator.cpp8
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.cpp6
2 files changed, 9 insertions, 5 deletions
diff --git a/sources/shiboken2/generator/generator.cpp b/sources/shiboken2/generator/generator.cpp
index fe03d3489..46ad90724 100644
--- a/sources/shiboken2/generator/generator.cpp
+++ b/sources/shiboken2/generator/generator.cpp
@@ -244,6 +244,13 @@ void Generator::addInstantiatedContainersAndSmartPointers(const AbstractMetaType
// Is smart pointer.
if (!m_d->instantiatedSmartPointerNames.contains(typeName)) {
m_d->instantiatedSmartPointerNames.append(typeName);
+ if (type->isConstant() || type->referenceType() != NoReference) {
+ // Strip a "const QSharedPtr<Foo> &" or similar to "QSharedPtr<Foo>" (PYSIDE-1016)
+ auto fixedType = type->copy();
+ fixedType->setReferenceType(NoReference);
+ fixedType->setConstant(false);
+ type = fixedType;
+ }
m_d->instantiatedSmartPointers.append(type);
}
}
@@ -912,7 +919,6 @@ QString getClassTargetFullName(const AbstractMetaType *metaType, bool includePac
QString getFilteredCppSignatureString(QString signature)
{
- TypeInfo::stripQualifiers(&signature); // for const refs to smart pointers
signature.replace(QLatin1String("::"), QLatin1String("_"));
signature.replace(QLatin1Char('<'), QLatin1Char('_'));
signature.replace(QLatin1Char('>'), QLatin1Char('_'));
diff --git a/sources/shiboken2/generator/shiboken2/headergenerator.cpp b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
index 17ebbcde9..a55539d7c 100644
--- a/sources/shiboken2/generator/shiboken2/headergenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
@@ -593,10 +593,8 @@ void HeaderGenerator::writeSbkTypeFunction(QTextStream& s, const AbstractMetaCla
void HeaderGenerator::writeSbkTypeFunction(QTextStream &s, const AbstractMetaType *metaType)
{
- QString signature = metaType->cppSignature();
- TypeInfo::stripQualifiers(&signature); // for const refs to smart pointers
- s << "template<> inline PyTypeObject *SbkType< ::" << signature << " >() "
- << "{ return reinterpret_cast<PyTypeObject *>(" << cpythonTypeNameExt(metaType) << "); }\n";
+ s << "template<> inline PyTypeObject* SbkType< ::" << metaType->cppSignature() << " >() "
+ << "{ return reinterpret_cast<PyTypeObject*>(" << cpythonTypeNameExt(metaType) << "); }\n";
}
void HeaderGenerator::writeInheritedOverloads(QTextStream& s)