Important: Please read the Qt Code of Conduct -

Remove QGroupBox Space

  • How can i remove QGroupbox space
    i already test
    @groupbox->setStyleSheet("QGroupBox::title { border: 0px ; border-radius: 0px; padding: 0px 0px 0px 0px; margin = 0px 0px 0px 0px } QGroupBox { border: 0px ; border-radius: 0px; padding: 0px 0px 0px 0px;} ");
    it reduce the space but not perfectly done!
    how can i remove space completely
    u can c a few space and margin in second radio group but not in first in follow image


  • Where is a groupBox on the picture? Is it whole picture?
    What space do you need to remove? Point it on the picture please.
    How do you create the groupBox? Do you use layouts?

  • in follow picture i located the groupbox with gray rectangle
    the above radioboxes are without groupbox and only layout used


    i'm trying to tag radiobox so each of four work independtly
    if there is any other way to do so i appreciate it

  • Try to set attribute Qt::WA_LayoutOnEntireRect on your groupbox.

  • thanks for reply but it doesn't change any thing

  • I don't understand what space do you need to remove.
    Is it the space between each radiobutton?

    Right now it looks like this:
    |o null |o null |o null |o null |

    Are you trying to put them close to each other like this:
    |o null |o null |o null |o null |

    If so, then you can create a horizontal layout put all groupboxes together and add horizontal spacer to fill rest of the place.

    If it is not what you need then, please, draw a picture of your desired design.

  • Hi,
    did you try this:
    group->setVisible(false); //that code will hide the QGroupBox widget

    about the radioboxes, create them with the same parent, so they will work dependently

    try something like this:

    QHBoxLayout *ly = new QHBoxLayout;
    QGroupBox *group = new QGroupBox("Countries");
    QWidget *widget = new QWidget;

    QRadioBox *r1 = new QRadioBox(tr("Ivory coast"),widget);
    QRadioBox *r2= new QRadioBox(tr("Germany"),widget);
    QRadioBox *r3 = new QRadioBox(tr("USA"),widget);
    //and other code

Log in to reply