summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.lima@openbossa.org>2010-05-20 10:52:46 -0300
committerHugo Parente Lima <hugo.lima@openbossa.org>2010-05-20 11:10:45 -0300
commit980a1a15f6cc34af58c121cbdbad2e40c878617a (patch)
treed4eb02b27b6cd5b4dd31876156b585909044a7bd
parent7bbe60a475322395eb7522a9b2fbee6682a47818 (diff)
downloadshiboken-980a1a15f6cc34af58c121cbdbad2e40c878617a.tar.gz
shiboken-980a1a15f6cc34af58c121cbdbad2e40c878617a.tar.xz
shiboken-980a1a15f6cc34af58c121cbdbad2e40c878617a.zip
Add a call to PySide::initQtMetaType for every type when the pyside extensions mode is on.
Reviewer: Renato Ara├║jo <renato.filho@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--cppgenerator.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/cppgenerator.cpp b/cppgenerator.cpp
index 8bf84a67..9677a9e7 100644
--- a/cppgenerator.cpp
+++ b/cppgenerator.cpp
@@ -134,8 +134,10 @@ void CppGenerator::generateClass(QTextStream &s, const AbstractMetaClass *metaCl
// headers
s << "// default includes" << endl;
s << "#include <shiboken.h>" << endl;
- if (usePySideExtensions())
+ if (usePySideExtensions()) {
s << "#include <qsignal.h>" << endl;
+ s << "#include <pyside.h>" << endl;
+ }
s << "#include <typeresolver.h>\n";
s << "#include <typeinfo>\n";
@@ -2822,6 +2824,12 @@ void CppGenerator::writeClassRegister(QTextStream& s, const AbstractMetaClass* m
s << "TypeResolver<" << typeName << " >" << "(typeid(" << typeName << ").name());\n";
}
+ if (usePySideExtensions() && !metaClass->isNamespace()) {
+ // Qt metatypes are registered only on their first use, so we do this now.
+ const char* star = metaClass->typeEntry()->isObject() ? "*" : "";
+ s << INDENT << "PySide::initQtMetaType<" << metaClass->qualifiedCppName() << star << " >();" << endl;
+ }
+
s << '}' << endl << endl;
}