Search code examples
qtqt-designer

Horizontal Layout only sharing space equally between two widgets


I'm building out my first GUI which goes deeper than a yes no button. I've been struggling with this problem longer than its worth, since its probably simple.

I have the following layout in designer:

current design

While I have the vertical spacing as desired, I want the QOpenGLWidget to take up most of the horizontal space. I cannot get the left layout to stop expanding when I expand the size of the window. I would assume I could set the layout to a fixed width, but that does not seem possible.


Solution

  • You just have to set the stretch factor in the layout, for this click on QHBoxLayout and change for the layoutStretch property from 0, 0 to 0, 1.

    enter image description here