I am creating an application in which i use different group box for different categories which contains radio buttons for items.But if i select an item from one group box and then from another group box,the item in previous group box remains checked. But i want that whenever i select an item f开发者_C百科rom different group box all other item must get deselected. Can anyone help me with this regard?? Thank you.
Radio buttons with different parents will behave as separate groups so the radio buttons will all need to have the same parent. You could overlay group boxes by positioning group boxes over the radio buttons but this will be problematic if you are using layouts. An alternative is to just separate the groups of radio buttons you want to distinguish by using labels or line separators.
Group all the buttons together with either 1 group as parent or something else like the form, just have them in the group boxes visually.
By default, radio buttons will only be exlusive between those with the same parent. However, there is a simple solution to this. A QButtonGroup can be used to specify which buttons are related. Your solution would be to create your own button group, then set that group on each of the radio buttons you would like to be mutually exclusive.
精彩评论