Imitate QRadioButton for QGroupBox
-
wrote on 28 Jul 2015, 14:31 last edited by
Hello
I try to create a customized QGroupBox which contains QWidget elements. These elements aren't QRadioButtons but have a similar behaviour, they are checkable and so on but also have additional sub-elements inside them. Is it possible to configure these QWidget elements in a way, that the QGroupBox sees them as QRadioButtons, so that exclusive selection is enabled?
Thanks for any help!
-
wrote on 28 Jul 2015, 14:38 last edited by
You could use the press slot of your elements to disable the others in the group. So if one is checked, the others switch to unchecked
-
Hi
I think the elements must be inherited from QAbstractButton for this to work.
-
wrote on 28 Jul 2015, 14:58 last edited by
Or from checkbox, or graphicssceneitem if it's something on the graphicsview. It depends on the element
-
Hi
Checkbox is a QAbstractButton child.
I think QButtonGroup is the one doing the real work of "exclusive" so I wonder if its possible to
create a child of QButtonGroup and teach it to handle new types.
But for QGroupBox, I did not trip over anything that suggest it can use another QButtonGroup. :(
3/5