summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrenatofilho <renato.filho@openbossa.org>2010-10-29 14:03:56 -0300
committerrenatofilho <renato.filho@openbossa.org>2010-10-29 16:20:41 -0300
commitd09decc37b49ca19593131c7fb59486d5cfb1c33 (patch)
treeb08ce6c2ffbb1f4945604d173805d7a538bb7898
parent7ac0c10741046f9079b6fdced015140a4846e0c1 (diff)
downloadshiboken-d09decc37b49ca19593131c7fb59486d5cfb1c33.tar.gz
shiboken-d09decc37b49ca19593131c7fb59486d5cfb1c33.tar.xz
shiboken-d09decc37b49ca19593131c7fb59486d5cfb1c33.zip
Implemented signal instantiation during the getattr function.
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com> Marcelo Lira <marcelo.lira@openbossa.org>
-rw-r--r--generator/cppgenerator.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index f5043faf..d01beca9 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