Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to set QGroupBox in the center?



  • Hi,

    I have QDialog and I would like to have on it QGroupBox and in this QGroupBox have QGridLayout and in this QGridLayout have random Widgets ( red in picture ). And I have, what I want.

    But I would like to have situation like in a picture:

    dialog.png

    So I would like to have an empty space between QGroupBox and QDialog' margins ( green arrows ). I tried with:

        dialog->setContentsMargins(100,100,100,100);
        mainGroupBox->setContentsMargins(100,100,100,100);
    

    But it doesn't do what I want.


  • Lifetime Qt Champion

    Hi,

    Did you put your QGrouoBox in a layout ?


Log in to reply