QT Designer Form Layout is Stretched at Runtime in Windows 10
-
I'm using Qt Creator Community with Desktop Qt 6.4.2 MinGW 64-bit.
I have a simple form with a few fields (it's a calculator to convert between common units in some CAD work). When the application runs, the layout becomes stretched. I think this is best explained with a couple images.
In the designer:
At runtime:
Scaling of the images on this webpage may be a bit misleading, so here's a description of the actual difference:
- Labels are the same size.
- Text Edits are the same vertical size, but stretched horizontally
- Horizontal margins are the same size
- Vertical margins are stretched
I'm pretty sure my Windows UI scaling setting is at 125%, the recommended setting for higher-DPI displays; could this be causing the difference? Just eyeballing it, it does look to be about 25% larger in both directions overall.
Is there a way to fix this other than setting Windows UI scaling to 100%?
-
@Brian_H said in QT Designer Form Layout is Stretched at Runtime in Windows 10:
When the application runs, the layout becomes stretched. I think this is best explained with a couple images.
Show your object tree (in Designer on the right) please.
I would say, this is what layouts do... It resizes the content as the parent grows/shrinks.
So this has to do with your layout settings and not with any DPI scaling -
Hi,
I think you're noticing the same behavior as described here: Why is this Designer form not sufficiently WYSIWYG?.
-
@Brian_H Add https://doc.qt.io/qt-6/qboxlayout.html#addStretch to your vertical layout at the bottom