[PyKDE] One slot called two times

Carles Pina i Estany carles at pina.cat
Sun Oct 22 10:03:20 BST 2006


Hello again,

On Oct/22/2006, Andreas Pakulat wrote:
> On 21.10.06 22:21:37, Carles Pina i Estany wrote:
> > I was used to connect signals and slots using "connect". Now I am
> > updating myself to Qt4 and using "autoconnect" feature. 
> > 
> > I have the simplest code that I can do and the slot is called two times.
> > The code is:
> 
> This is known, but I'm not sure it is documented in the PyQt4 docs.
> There are actually 2 signals in QPushButton that are called "clicked",
> one takes an argument one doesn't. I don't know how the connection is
> done by PyQt, but you end up having both signals connected to your slot. 
> 
> The proper way to solve this is to use a method signature telling PyQt4
> which signal you want to connect to, by giving the proper arguments.
> This is documented in the PyQt4 docs (I don't have an example at hand).

ops completly my blame, I haven't read all documentation (ops!). I have
solved the pushButton_2_clicked on that way:

        @QtCore.pyqtSignature("")
        def on_pushButton_2_clicked(self):
                print "automatic"

More information:
http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html#the-qtcore-pyqtsignature-decorator

Thanks to point me :-)

-- 
Carles Pina i Estany		GPG id: 0x8CBDAE64
	http://pinux.info	Manresa - Barcelona




More information about the PyQt mailing list