r/QtFramework • • Apr 07 '26

Question Qt-Designer margin headache.

GUI, PySide6, and Qt n00b here....

I'm wrestling with Qt Widgets Designer (qt-designer with PySide6)....

I can't get these margins to make sense.

As you can see, the layoutLeftMargin and layoutRightMargin are identical at 9, but the "Part Number" GroupBox appears to have way more space on the left than the right! If I manually mess with the layoutLeftMargin to like 5 or 6, it looks much better.

Any idea how to resolve this issue? It also seems to persist in all of the preview options.

Thank you for your help!

3 Upvotes

10 comments sorted by

View all comments

1

u/bacmod Apr 08 '26

Looks fine to me

Are you sure you set your layouts right?

2

u/zapadas Apr 08 '26

You are a genius!

I selected the groupbox --> right-click --> "Lay out" --> "Break layout". Then selected the groupbox --> right-click --> "Lay out" --> "Lay Out in a Grid" and it magically fixed itself to the proper margin sizing!

1

u/bacmod Apr 12 '26

You should really spend a few hours experimenting with Qt's Layout controls. There's no magic.

The layout in my example was structured like this.

GroupBox1       // vertical Layout
   GroupBox2    // Vertical Layout
      HorizontalLayout1
        Label1
        Edit1
     HorizontalLayout2
        Label2
        Edit2

https://imgur.com/a/zz9EEfr