Important: Please read the Qt Code of Conduct -

Qtdesigner: how radio button group together?

  • I am using Qtdesigner for a UI interface. I found that if I use a Qgroupbox to group all Qradiobuttons together, and only Qradiobuttons, they can be selected normally, that mean one is selected and all other are unselected. But if I put Qrabiobuttons into one QgroupBox, and also, there are other stuffs in the same Qgroubox, such as label, lineedit, pushbutton, those radionbuttons cannot be checked exclusively. Is it possible to make them work with different items in the same groupbox?

  • Have you considered arranging QRadioButtons in their groupboxes and then organize your design using layouts?I feel that QGroupBox is there to bundle QRadioButtons and QCheckBoxes together.

  • You can also create a button group explicitly for your radio buttons. Select the ones you want to group, and right click on one of them. Then, you'll find an option to "group" the buttons. If you click that, you will notice that a new QButtonGroup has appeared in your object browser in designer. You can select that button group to give it a name, make it exclusive, etc.

  • Andre,
    Thanks. It is good to have rating systems for answers as well.

  • @andre I just logged into this old thread to say "Thank you" to Andre for the handy tip.

Log in to reply