[PyQt] New style signals question

Baz Walter bazwal at ftml.net
Wed Aug 4 19:55:10 BST 2010


On 04/08/10 18:50, detlev wrote:
> in my code I have a line like
>
> act.triggered.connect(self.myslot)
>
> The slot has a method signature like
>
> def myslot(self, fn = None, foo = "bar"):
>
> However, it is always called with fn set to False. It seems that
> triggered(bool) is the default signal. How do I get my slot connected to the
> triggered() signal? Using the old style I could use SIGNAL("triggered()").

i've always used SIGNAL('triggered()') for QActions as well (i'm 
assuming 'act' is a QAction).

but looking at the docs, the actual signature is:
	
     triggered ( bool checked = false )

rather than:

     triggered ( bool checked )

so i suppose that may explain why the old style still works.

this is going to be even more awkward for actions connected to qt slots 
which don't have an compatible overload, because changing to the new 
syntax will now produce a TypeError.


More information about the PyQt mailing list