[Solved] How to enable/disable Part of the QButtonGroup? Is it possible?
-
Hi,
I have a application with three different radio buttons. I added them to a button group like below.
@QButtonGroup *brackets_button_group;
brackets_button_group = new QButtonGroup();//suppose I have enum BRACKET
brackets_button_group->addButton(ui->a_radio_button,Bracket::A);
brackets_button_group->addButton(ui->b_radio_button,Bracket::B);
brackets_button_group->addButton(ui->c_radio_button,Bracket::C); @This button group is working as intended.
But I need to enable/disable part of the button group according to some value as below.
@if(my_value == 60)
{
//All buttons should be enabled
}
else if (my_value < 60)
{
//button c should be disabled and unchecked
}
else
{
//only c should be checked and enabled
}@Is there any best practice for doing that, rather than enable/disable each button?
Thanks for reading. :)
-
Hi,
Depending on how you manage your my_value variable you could use a QStateMachine to enable/disable your button accordingly. Otherwise no, there's no "partial" button group handling.
-
Thank you very much SGaist. It was done. :)
-
Nice !
Then please update the thread title prepending [solved] so other forum users may know a solution has been found :)