[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] simpler 'connect' function
From:       Phil Thompson <phil () riverbankcomputing ! co ! uk>
Date:       2008-01-10 17:59:40
Message-ID: 200801101759.41010.phil () riverbankcomputing ! co ! uk
[Download RAW message or body]

On Thursday 10 January 2008, Peter Shinners wrote:
> I'm sure this has come up, but as I write my Pyqt code, I keep noticing
> that the QObject.connect call feels like a wart. Is there already a pyqt
> shortcut for a call like this?
>
>     QtCore.QObject.connect(myButton, QtCore.SIGNAL("clicked()"),
> onClicked)
>
> The closer I could be to something like the following, the better.
>
>     myButton.connect("clicked()", onClicked)
>
> Are there any shortcuts for wiring signals and slots I haven't noticed?

No, but a few ideas have been thrown around on the list in the past couple of 
days.

Your suggestion is nice and concise - the dropping of SIGNAL() was briefly 
discussed during developed of PyQt4.

One sublety of your suggestion is that "self" provides the emitter object 
whereas the short form of the Qt connect uses "this" to provide the slot 
object. I don't know if that would be counter-intuitive.

I'd like people to continue to throw out suggestions and see if any sort of 
concensus appears. The existing method for making connections will be 
retained no matter what.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic