2011/7/24 Erik Janssens <[email protected]>: > On Sun, 2011-07-24 at 11:00 +0200, Sebastian Wiesner wrote: >> 2011/7/23 Erik Janssens <[email protected]>: >> > Hi, >> > >> > when connecting a Python method to the >> > QObject.destroyed signal, it seems as >> > if the connected slot is only called with >> > one argument instead of two, this results >> > in : >> > >> > TypeError: destroyed_slot() takes exactly 2 arguments (1 given) >> > Error calling slot "destroyed_slot" >> > >> > while I would expect 2 arguments (self and >> > the object being destroyed). >> > >> > am I missing something or is this possibly >> > a bug ? >> >> The "destroyed()" signal is overloaded, so there are actually two >> signals "destroyed()" and "destroyed(QObject)". You apparently >> connected to the former. In order to connect to the latter, you need >> to explicitly choose the right signature: >> "obj.destroyed[QObject].connect(self.destroyed_slot)" > > You are right, choosing the right signature works. But how do > you know this signal is overloaded, I cannot see this mentioned > in the docs ?
I don't know about the PySide documentation, but you can easily see that in the Qt documentation [1]. The signature of "destroyed" is "QObject::destroyed(QObject *obj=0)". The argument "obj" has a default value, and C++ implements default values for arguments by generating overloaded functions. [1] http://doc.qt.nokia.com/latest/qobject.html#destroyed _______________________________________________ PySide mailing list [email protected] http://lists.pyside.org/listinfo/pyside
