How to fix the size of my Qt window?
Asked Answered
H

1

1

I have a QWidget, the parent class for all my other widgets. In Qt Designer I set width = 600 and height = 400 for the QWidget. My size Policy is [Fixed, Fixed, 0, 0].

But if I start my the application the QWidgets size is at least 2500*400. How could I fix the size at application start to 600*400?

Homocentric answered 20/8, 2015 at 11:6 Comment(2)
Maybe you have set size policy of central widget rather than the mainwindow. Or you can set the size at the last of construction of mainwindow.Tectonics
Did you set the max size too?Aubine
M
2

The size policy on a toplevel layout is meaningless if you don't set the size constraint as well via QLayout::setSizeConstraint. It is the size constraint that links the layout to the toplevel widget's size.

Messer answered 20/8, 2015 at 19:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.