[PyQt] connectSlotsByName and signals emitted by dialogs?

Phil Thompson phil at riverbankcomputing.com
Thu Aug 7 16:50:01 BST 2008


On Thu, 07 Aug 2008 12:29:19 +0300, Matti Airas <mairas at iki.fi> wrote:
> Hey all,
> 
> I'm trying to get the grips on PyQt4 basics. I've been toying with a
> simple dialogs, which I have constructed using Qt Designer and then
> converted with pyuic4. I can inherit and use the created class with no
> problem, but somehow the quite neat connectSlotsByName baffles me: it
> doesn't seem to connect to the accepted signal emitted by the dialog.
> 
> Here's what I have tried:
> 
>     @pyqtSignature("")
>     def on_ItemInputDialog_accepted(self):
> 	[...]
> 
> but the function never gets executed. If I connect to the function
> manually, it works fine:
> 
> 	self.connect(self, SIGNAL("accepted()"),
> self.on_ItemInputDialog_accepted)
> 
> The connectSlotsByName thingy also works if I try to connect to e.g. the
> dialog button box:
> 
>     @pyqtSignature("")
>     def on_buttonBox_accepted(self):
> 	[...]
> 
> Can anyone relate to this?

connectSlotsByName() (according to the documentation) connects the children
of its argument, and not the argument (ie. the dialog) itself.

It does sound like a limitation, but unless there is a bug in the
documentation, it is the intended behaviour.

Phil



More information about the PyQt mailing list