aboutsummaryrefslogtreecommitdiffstats
path: root/cppgenerator.cpp
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2009-12-15 12:21:34 -0200
committerHugo Lima <hugo.lima@openbossa.org>2009-12-16 15:39:12 -0200
commit0133a99f71e88c9e0642f05a7d55ef798275260a (patch)
treed75b59340f94e9add0825eda50070e0f55c87896 /cppgenerator.cpp
parentf41cf0af8ed705d342ea448acac89659eea64bfd (diff)
Added the option --enable-pyside-extensions to enable PySide extensions.
You need to enable these extensions if you are generating a binding for a Qt-based library and need to pass some types through the signal slots mechanism. If you turn this flag on, you also need to link the generated bindings with the libpyside, besides add libpyside include path to your project. Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'cppgenerator.cpp')
-rw-r--r--cppgenerator.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/cppgenerator.cpp b/cppgenerator.cpp
index d89a74ecb..13c849dd4 100644
--- a/cppgenerator.cpp
+++ b/cppgenerator.cpp
@@ -90,6 +90,8 @@ void CppGenerator::generateClass(QTextStream &s, const AbstractMetaClass *metaCl
// headers
s << "// default includes" << endl;
s << "#include <shiboken.h>" << endl;
+ if (usePySideExtensions())
+ s << "#include <typeresolver.h>\n";
// The multiple inheritance initialization function
// needs the 'set' class from C++ STL.
@@ -2112,6 +2114,13 @@ void CppGenerator::writeClassRegister(QTextStream& s, const AbstractMetaClass* m
writeCodeSnips(s, metaClass->typeEntry()->codeSnips(), CodeSnip::End, TypeSystem::TargetLangCode, 0, 0, metaClass);
}
+ if (usePySideExtensions() && !metaClass->isNamespace()) {
+ QString type = metaClass->typeEntry()->isValue() ? "Value" : "Object";
+ QString typeName = metaClass->qualifiedCppName();
+ s << INDENT << "PySide::TypeResolver::create" << type << "TypeResolver<" << typeName << " >";
+ s << "(\"" << typeName << "\");\n";
+ }
+
s << '}' << endl << endl;
}