diff options
Diffstat (limited to 'generator/cppgenerator.cpp')
-rw-r--r-- | generator/cppgenerator.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp index 9e8007f6d..687a24499 100644 --- a/generator/cppgenerator.cpp +++ b/generator/cppgenerator.cpp @@ -1471,12 +1471,21 @@ void CppGenerator::writeInvalidPyObjectCheck(QTextStream& s, const QString& pyOb void CppGenerator::writeTypeCheck(QTextStream& s, const AbstractMetaType* argType, QString argumentName, bool isNumber, QString customType) { - if (!customType.isEmpty()) - s << guessCPythonCheckFunction(customType); - else if (argType->isEnum()) - s << cpythonIsConvertibleFunction(argType, false); + AbstractMetaType* metaType; + std::auto_ptr<AbstractMetaType> metaType_autoptr; + QString customCheck; + if (!customType.isEmpty()) { + customCheck = guessCPythonCheckFunction(customType, &metaType); + if (metaType) { + metaType_autoptr = std::auto_ptr<AbstractMetaType>(metaType); + argType = metaType; + } + } + + if (customCheck.isEmpty()) + s << cpythonIsConvertibleFunction(argType, argType->isEnum() ? false : isNumber); else - s << cpythonIsConvertibleFunction(argType, isNumber); + s << customCheck; s << '(' << argumentName << ')'; } |