[PyQt] QCheckBox problem

Ulrich Berning ulrich.berning at denviso.de
Thu Jan 8 11:20:18 GMT 2009


Doug Hackworth wrote:

>
> > FoobarApplication is calling the wrong super-class __init__.
>
> Duly noted, thanks for the correction.  I changed it to call 
> QtGui.QMainWindow.__init__() instead.  The change produced no visible 
> effect, but I assume it's a better initialization to call, so thanks 
> for pointing this out.
>
>
>> Use the stateChanged(int) signal instead.
>
>
> That did the trick, thanks!  Question:  Was I wrong to use the 
> toggled() signal and should have known to use stateChanged(int) 
> instead?  What's the difference between the two?

The toggled signal is defined as: void QAbstractButton::toggled ( bool 
checked )
Use  QtCore.SIGNAL("toggled(bool)") instead of 
QtCore.SIGNAL("toggled()") and it will work as expected.
Because a QCheckBox can be a tri-state checkbox , it's better to use 
stateChanged(int) instead of toggled(bool).

Ulli



More information about the PyQt mailing list