How to fix the size of my Qt window?

时光怂恿深爱的人放手 提交于 2019-12-24 11:34:54

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/32116583/how-to-fix-the-size-of-my-qt-window

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!