[PyQt] Autoconnecting two signals to the same method.

Rocco Orlando Rossi rocco.rossi at gmail.com
Sat Mar 15 09:38:42 GMT 2008


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?


2008/3/15, Andreas Pakulat <apaku at gmx.de>:
>
> On 15.03.08 09:31:14, Rocco Orlando Rossi wrote:
> > Hi all.
> >
> > I'm new to PyQt. I'm coming from pygtk and Glade, but I am really very
> > interested in trying out PyQt, Eric, and Designer as a more valid
> > alternative.
> >
> > Now, very briefly, here's my problem. I was attempting to
> autoconnect  two
> > different signals to the same method function, but I quickly realized
> that
> > it isn't at all obvious how to go about doing something like that. I
> thought
> > the decorator pyqtSignature might do the trick, but unfortunately
> chaining
> > those decorators did not work.
> >
> > Any ideas?
>
>
> The simple answer is: You can't. That is you can't do this via the
> auto-connect feature. That features uses the method name to find out the
> actual signal to use, so on_pushButton_clicked is a slot thats only
> called when the clicked signal of "pushButton" is emitted.
>
> You have to write the two connect statements in your __init__.
>
> Andreas
>
>
> --
> Your boss climbed the corporate ladder, wrong by wrong.
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>



-- 
Rocco Rossi

-----------------------------------------------------------------

"Alcuni vedono le cose come sono e dicono perché? Io sogno cose non ancora
esistite e chiedo perché no?"

G.B. Shaw
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080315/54b79b7a/attachment.html


More information about the PyQt mailing list