开发者

QRadioButtons in two different layouts

开发者 https://www.devze.com 2023-04-02 02:54 出处:网络
I have defined QRadiobuttons in two different layouts.Three in the one and 3 in the other, respectively. These buttons should be independe开发者_开发问答nt, but when i push one of the one layout the o

I have defined QRadiobuttons in two different layouts.Three in the one and 3 in the other, respectively. These buttons should be independe开发者_开发问答nt, but when i push one of the one layout the other button from the other layout is deselected. And therefore there is always only one Radiobutton selected. I want to be able to select one Radiobutton from the one layout and one from the other. How could I avoid this problem. Thanks


From the QRadioButton docs:

If auto-exclusive is enabled, radio buttons that belong to the same parent widget behave as if they were part of the same exclusive button group. If you need multiple exclusive button groups for radio buttons that belong to the same parent widget, put them into a QButtonGroup.

(Auto-exclusive is on by default.)

You should do that (and continue adding the individual QRadioButtons to your layout).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号