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

Problem with alignment of elements within a QGridLayout



  • Please have a look at the picture showing my QGridLayout below. Blue are widgets, magenta shows my grid layout. The two green "buttons" are in a QHBoxLayout within a QFrame.
    I want those two buttons to align right within that first column without them stretching that column.

    Using insertStretch(0) on the QHBoxLayout or setting the buttons to Qt::AlignRight both stretches the column.
    I feel like this can be solved with a correct QSizePolizy, but I can't find a working combination.

    (The "^ Stretch v"-text has nothing to do with the issue btw.)

    alt text


Log in to reply