[PyKDE] Problems with auto-connect and QAbstractButton.clicked()

Phil Thompson phil at riverbankcomputing.co.uk
Thu Jan 26 17:57:53 GMT 2006


On Thursday 26 January 2006 5:38 pm, Andreas Pakulat wrote:
> On 26.01.06 17:12:15, Phil Thompson wrote:
> > On Thursday 26 January 2006 3:49 pm, Andreas Pakulat wrote:
> > > Hi,
> > >
> > > I have 2 problems with QAbstractButton.clicked and auto-connection:
> > >
> > > 1. the auto-connected slot gets called twice, I have no idea why
> >
> > Because the signal is emitted twice, once with no argument and once with
> > a bool argument.
>
> This is due to PyQt4's signal/slot implementation right? Because I can't
> reproduce that under C++ and I can't see more than 1 emit in the Qt4
> source.

Sort of. It looks like moc implements signals with optional arguments by 
defining multiple signals in the meta-object. PyQt has no way of knowing how 
many signals there really are.

> > > 2. according to Qt4 docs clicked has a boolean argument which I cannot
> > > use with the autoconnected slot.
> >
> > It has an optional bool argument so define the slot as...
> >
> >     def on_pushButton_clicked(self, checked=None):
> >
> > ...and then decide which call you are going to respond to
>
> Ok, thanks for the suggestion.
>
> Will any of these change with the new snapshots coming out this night?
> Just curious.

No.

Phil




More information about the PyQt mailing list