如何修复我的 Qt 窗口的大小? [英] How to fix the size of my Qt window?

查看:46
本文介绍了如何修复我的 Qt 窗口的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 QWidget,它是我所有其他小部件的父类.在 Qt Designer 中,我为 QWidget 设置了 width = 600height = 400.我的尺码政策是 [Fixed, Fixed, 0, 0].

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].

但是如果我启动我的应用程序,QWidgets 的大小至少是 2500*400.如何将应用程序启动时的大小固定为 600*400?

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?

推荐答案

如果您没有通过 QLayout::setSizeConstraint 设置大小约束,那么顶层布局的大小策略是没有意义的.尺寸约束将布局与顶级小部件的尺寸联系起来.

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.

这篇关于如何修复我的 Qt 窗口的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆