[PyQt] Autoconnecting two signals to the same method.

Phil Thompson phil at riverbankcomputing.com
Sat Mar 15 10:39:58 GMT 2008


On Saturday 15 March 2008, Rocco Orlando Rossi wrote:
> Thanks.
>
> OK. I understand that.
>
> And what if the decorator @QtCore.pyqtSignature were modified to accept
> more than one argument, so that you could do something like the following?
>
> @QtCore.pyqtSignature("on_pushButton1_clicked()",
> "on_pushButton2_clicked()")
>     def on_pushButton_clicked(self):
>         print "Hi Man!"
>
> Perhaps this is something that can be achieved.
>
> What do you think?

That may break other uses of pyqtSignature(). However I don't see why the 
following shouldn't be made to work...

    @QtCore.pyqtSignature("on_pushButton1_clicked()")
    @QtCore.pyqtSignature("on_pushButton2_clicked()")
    def on_pushButton_clicked(self):
        print "Hi Man!"

Phil


More information about the PyQt mailing list