diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-05-23 11:42:14 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:15:23 -0300 |
commit | 7e1459b2a29045527a4bf3c5a840a2c38933760a (patch) | |
tree | 15e00fd309dccca2b2d0d18b591ac42b03df2acb /generator | |
parent | 95f7d0a2c1a417e81bf2cab00075e28a8d22660f (diff) |
Generate code using the new pyside class DestroyListener.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
Diffstat (limited to 'generator')
-rw-r--r-- | generator/cppgenerator.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp index fcd1b3706..ce0a80454 100644 --- a/generator/cppgenerator.cpp +++ b/generator/cppgenerator.cpp @@ -278,6 +278,7 @@ void CppGenerator::generateClass(QTextStream &s, const AbstractMetaClass *metaCl s << "#include <pysidesignal.h>" << endl; s << "#include <pysideproperty.h>" << endl; s << "#include <pyside.h>" << endl; + s << "#include <destroylistener.h>" << endl; } s << "#include <typeresolver.h>" << endl; @@ -597,8 +598,13 @@ void CppGenerator::writeDestructorNative(QTextStream &s, const AbstractMetaClass { Indentation indentation(INDENT); s << wrapperName(metaClass) << "::~" << wrapperName(metaClass) << "()" << endl << '{' << endl; - s << INDENT << "SbkObject* wrapper = Shiboken::BindingManager::instance().retrieveWrapper(this);" << endl; - s << INDENT << "Shiboken::Object::destroy(wrapper, this);" << endl; + // kill pyobject + if (usePySideExtensions() && metaClass->isQObject()) { + s << INDENT << "PySide::DestroyListener::instance()->listen(this);" << endl; + } else { + s << INDENT << "SbkObject* wrapper = Shiboken::BindingManager::instance().retrieveWrapper(this);" << endl; + s << INDENT << "Shiboken::Object::destroy(wrapper, this);" << endl; + } s << '}' << endl; } |