I have a group of 3 QRadioButtons and 2 checkable QGroupBoxes that need to all be mutually exclusive. I like the convenience of adding my radio buttons to a QButtonGroup to automatically handle this, but I can't seem to figure out how to add the QGroupBox to the button group because it doesn't inherit from QAbstractButton and I can't find access to its checkbox.
For example,
QRadioButton* rb1 = new QRadioButton("Button1");
QRadioButton* rb2 = new QRadioButton("Button2");
QRadioButton* rb3 = new QRadioButton("Button3");
QGroupBox* gb1 = new QGroupBox;
gb1->setCheckable(true);
QGroupBox* gb2 = new QGroupBox;
gb2->setCheckable(true);
QRadioButton* rb1 = new QRadioButton("Button1");
QButtonGroup* grp = new QButtonGroup;
grp->addButton(rb1);
grp->addButton(rb2);
grp->addButton(rb3);
grp->addButton(gb1); //these two fail
grp->addButton(gb2);
Is there a simple way to accomplish this? I know that I can connect to QGroupBox's clicked() signal, but I rather do this more cleanly than that.