From 7bc6abba6c12fc30fbb96fbb3a19520c896b0f93 2012-04-26 11:17:32 From: florianlink Date: 2012-04-26 11:17:32 Subject: [PATCH] generate extra wrappers for virtual slots to allow correct deriving via Python and to avoid recursion git-svn-id: svn://svn.code.sf.net/p/pythonqt/code/trunk@214 ea8d5007-eb21-0410-b261-ccb3ea6e24a9 --- diff --git a/generator/abstractmetalang.h b/generator/abstractmetalang.h index c35ac4b..6ceafb1 100644 --- a/generator/abstractmetalang.h +++ b/generator/abstractmetalang.h @@ -489,7 +489,7 @@ public: FunctionType functionType() const { return m_function_type; } void setFunctionType(FunctionType type) { m_function_type = type; } - bool isVirtual() { return !(isFinal() || isSignal() || isStatic()); } + bool isVirtual() const { return !(isFinal() || isSignal() || isStatic()); } QStringList introspectionCompatibleSignatures(const QStringList &resolvedArguments = QStringList()) const; QString signature() const; diff --git a/generator/shellheadergenerator.cpp b/generator/shellheadergenerator.cpp index f2d6e22..5d2bfa1 100644 --- a/generator/shellheadergenerator.cpp +++ b/generator/shellheadergenerator.cpp @@ -272,7 +272,7 @@ void ShellHeaderGenerator::write(QTextStream &s, const AbstractMetaClass *meta_c AbstractMetaFunctionList functions = getFunctionsToWrap(meta_class); foreach (const AbstractMetaFunction *function, functions) { - if (!function->isSlot()) { + if (!function->isSlot() || function->isVirtual()) { s << " "; writeFunctionSignature(s, function, 0, QString(), Option(ConvertReferenceToPtr | FirstArgIsWrappedObject| IncludeDefaultExpression | OriginalName | ShowStatic | UnderscoreSpaces)); diff --git a/generator/shellimplgenerator.cpp b/generator/shellimplgenerator.cpp index 6b7c874..c942a26 100644 --- a/generator/shellimplgenerator.cpp +++ b/generator/shellimplgenerator.cpp @@ -226,8 +226,10 @@ void ShellImplGenerator::write(QTextStream &s, const AbstractMetaClass *meta_cla // write member functions for (int i = 0; i < functions.size(); ++i) { AbstractMetaFunction *fun = functions.at(i); - if (fun->isSlot()) continue; - + bool needsWrapping = (!fun->isSlot() || fun->isVirtual()); + if (!needsWrapping) { + continue; + } writeFunctionSignature(s, fun, meta_class, QString(), Option(ConvertReferenceToPtr | FirstArgIsWrappedObject | OriginalName | ShowStatic | UnderscoreSpaces), "PythonQtWrapper_"); diff --git a/generator/typesystem_core.xml b/generator/typesystem_core.xml index 6e3990e..54b0b13 100644 --- a/generator/typesystem_core.xml +++ b/generator/typesystem_core.xml @@ -489,8 +489,7 @@ - - +