> > 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/Do...ture-decorator
Partager