PDA

View Full Version : QRadioButton and QButtonGroup



joseche
27th July 2012, 06:50
Hi all,

I started my C++ Gui Application and used the form to put a few components. I have two groups of QRadioButtons, but I couldn't find the way to create the groups graphically (perhaps not possible ?, I didn't find the QButtonGroup on the qt creator... ).

So I tried to use the constructor for that:


onOff= new QButtonGroup;
onOff->addButton(ui->on);
onOff->addButton(ui->off);

metric= new QButtonGroup;
metric->addButton(ui->m_24);
metric->addButton(ui->m_34);
metric->addButton(ui->m_44);
metric->addButton(ui->m_68);


But doesn't work either. How can I manage the radio groups ?

thanks

sonulohani
28th July 2012, 12:08
Go here and check the example:----

http://www.codeprogress.com/cpp/libraries/qt/qButtonGroupConnectButtonPress.php#.UBPHXRIXUWc

amleto
28th July 2012, 12:45
reading the docs helps... button group is not a widget - you will not find it in qt designer. If you want to group buttons graphically then use a QFrame or a QGroupBox and a QLayout