Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, December 2007
Qt 4.3.3, Win XP - QRadio buttons still not exclusive


Message 1 in thread

As in earlier versions, according to the docs, "Radio buttons are 
autoExclusive by default. If
auto-exclusive is enabled, radio buttons that belong to the same parent
widget behave as if they were part of the same exclusive button group."

But if I add two radio buttons to the same parent dialog (derived from
QDialog),   they are not exclusive.  Each can be toggled on/off without 
affecting the
other.







--
 [ signature omitted ] 

Message 2 in thread

John Smith wrote:
> But if I add two radio buttons to the same parent dialog (derived from
> QDialog),   they are not exclusive.  Each can be toggled 
> on/off without affecting the other.

Are you sure that the buttons are direct siblings?
if their direct parent is the same widget, the auto-exclusive behaviour
should work.
you probably have more widgets between your dialog and the radio
buttons.

If this doesn't help, show us some (stripped down!) code.

Cheers,
Peter

--
 [ signature omitted ] 

Message 3 in thread

"Peter Prade" <prade@xxxxxxxxxxx> wrote in message 
news:1C5B9B48EC79514FB4F4A7884ACFCB9F3CB894@xxxxxxxxxxxxxxxxxxxxxxx
John Smith wrote:
> But if I add two radio buttons to the same parent dialog (derived from
> QDialog),   they are not exclusive.  Each can be toggled
> on/off without affecting the other.

>Are you sure that the buttons are direct siblings?
>if their direct parent is the same widget, the auto-exclusive behaviour
>should work.
>you probably have more widgets between your dialog and the radio
>buttons.

>If this doesn't help, show us some (stripped down!) code.

>Cheers,
>Peter

There's no "between".  This behaviour has been reported previously
and exists  in 4.2.2, 4.3.2, and 4.3.3.






--
 [ signature omitted ] 

Message 4 in thread

Using Qt 4.3.2 and Win XP (Visual Studio 2005) this works fine for me:

#include <QtGui>
int main(int argc, char *argv[])
{
	QApplication a(argc, argv);
	QWidget w;
	QVBoxLayout l(&w);
	for(int i=0;i<3;i++) 
	{
		QRadioButton *rb = new QRadioButton(&w);
		rb->setText(QString::number(i));
		l.add(rb);
	}
	w.show();
	a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
	a.exec();
} 

> -----Ursprüngliche Nachricht-----
> Von: John Smith [mailto:invalid@xxxxxxxxxxx] 
> Gesendet: Freitag, 14. Dezember 2007 23:31
> An: qt-interest@xxxxxxxxxxxxx
> Betreff: Re: Qt 4.3.3, Win XP - QRadio buttons still not exclusive
> 
> 
> "Peter Prade" <prade@xxxxxxxxxxx> wrote in message 
> news:1C5B9B48EC79514FB4F4A7884ACFCB9F3CB894@xxxxxxxxxxxxxxxxxxxxxxx
> John Smith wrote:
> > But if I add two radio buttons to the same parent dialog 
> (derived from
> > QDialog),   they are not exclusive.  Each can be toggled
> > on/off without affecting the other.
> 
> >Are you sure that the buttons are direct siblings?
> >if their direct parent is the same widget, the 
> auto-exclusive behaviour
> >should work.
> >you probably have more widgets between your dialog and the radio
> >buttons.
> 
> >If this doesn't help, show us some (stripped down!) code.
> 
> >Cheers,
> >Peter
> 
> There's no "between".  This behaviour has been reported previously
> and exists  in 4.2.2, 4.3.2, and 4.3.3.

--
 [ signature omitted ] 

Message 5 in thread

The radio buttons that you want exclusive of each other must all belong to
the same QButtonGroup. QDialog has (at least should have) nothing to do with
it.

Keith
**Please do not reply to me, reply to the list.**


On 12-14-2007 4:31 PM, "John Smith" wrote:

> 
> "Peter Prade" <prade@xxxxxxxxxxx> wrote in message
> news:1C5B9B48EC79514FB4F4A7884ACFCB9F3CB894@xxxxxxxxxxxxxxxxxxxxxxx
> John Smith wrote:
>> But if I add two radio buttons to the same parent dialog (derived from
>> QDialog),   they are not exclusive.  Each can be toggled
>> on/off without affecting the other.
> 
>> Are you sure that the buttons are direct siblings?
>> if their direct parent is the same widget, the auto-exclusive behaviour
>> should work.
>> you probably have more widgets between your dialog and the radio
>> buttons.
> 
>> If this doesn't help, show us some (stripped down!) code.
> 
>> Cheers,
>> Peter
> 
> There's no "between".  This behaviour has been reported previously
> and exists  in 4.2.2, 4.3.2, and 4.3.3.
> 


--
 [ signature omitted ]