[PyQt] How to use QButtonGroup?
Sibylle Koczian
Sibylle.Koczian at t-online.de
Tue Nov 27 20:37:03 GMT 2007
Am Sonntag, 25. November 2007 23:58:52 schrieb David Boddie:
> On Sun Nov 25 14:05:39 GMT 2007, Sibylle Koczian wrote:
> > I'm reading the documentation about QButtonGroup and QGroupBox and I
> > don't quite understand the relationship between them.
>
> I think the relationship between them in Qt 3 is a different to that in Qt
> 4, so that might also be a cause of confusion for some people.
>
I don't know much Qt 3, Qt 4 alone is just difficult enough.
> > I can create QRadioButtons and put them into a QGroupBox. That makes them
> > visible and mutually exclusive. And, of course, I should put a layout
> > between the box and the buttons. Right?
>
> Correct.
>
> > If I put those same buttons into a QButtonGroup, then I can map them to
> > integers, and I can connect the buttonClicked(int) signal of the group to
> > a method or function that can use the id of the button. Still right?
>
> Correct again.
>
> > But there seems to be no connection between the QGroupBox and the
> > QButtonGroup. I have to put each of my radio buttons into the box _and_
> > into the buttongroup. Right, or did I overlook something?
>
> Yes, the QButtonGroup object just acts as a messenger for the buttons. You
> still need to put them inside a widget, and a QGroupBox widget is usually
> the sort of widget you would use.
>
Thank you, so that's cleared up. The next problem is still too vague for
sensible questions, but they will come.
--
Dr. Sibylle Koczian
More information about the PyQt
mailing list