diff options
author | renatofilho <renato.filho@openbossa.org> | 2010-10-29 14:03:56 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:08:54 -0300 |
commit | 2fb33ff364de0d134d3af9eb3d7a0a2fcf9e4877 (patch) | |
tree | a8ea84a58847c535bb1c1ed58e969a2134f1da08 /generator | |
parent | 514544828d7b23cb7c78841a93a8ba30f2a9b830 (diff) |
Implemented signal instantiation during the getattr function.
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com>
Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'generator')
-rw-r--r-- | generator/cppgenerator.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp index f5043fafd..d01beca9b 100644 --- a/generator/cppgenerator.cpp +++ b/generator/cppgenerator.cpp @@ -3518,8 +3518,18 @@ void CppGenerator::writeGetattroFunction(QTextStream& s, const AbstractMetaClass } s << INDENT << "}" << endl; - s << INDENT << "//search on metaobject (avoid internal attributes started with '__')" << endl - << INDENT << "if (!attr && !QString(PyString_AS_STRING(name)).startsWith(\"__\")) {" << endl; + //mutate native signals to signal instance type + s << INDENT << "if (attr && PyObject_TypeCheck(attr, &PySideSignalType)) {" << endl; + { + Indentation indent(INDENT); + s << INDENT << "PyObject* signal = reinterpret_cast<PyObject*>(PySide::signalInitialize(attr, name, self));" << endl + << INDENT << "PyObject_SetAttr(self, name, signal);" << endl + << INDENT << "return signal;" << endl; + } + s << INDENT << "}" << endl; + + //search on metaobject (avoid internal attributes started with '__')"; + s << INDENT << "if (!attr && !QString(PyString_AS_STRING(name)).startsWith(\"__\")) {" << endl; { Indentation indent(INDENT); s << INDENT << "QObject* cppSelf = Converter<QObject*>::toCpp(self);" << endl |