设置窗体相关

1、设置窗口禁止最大化和禁止最小化

在ui界面将QWidget的Maxmumsize和Minimumsize的长一样,宽也一样

2、设置app启动自动最大或最小

this->setWindowState(Qt::WindowMaximized);

有以下选项:

ConstantValueDescription
Qt::WindowNoState 0x00000000 The window has no state set (in normal state).
Qt::WindowMinimized 0x00000001 The window is minimized (i.e. iconified).
Qt::WindowMaximized 0x00000002 The window is maximized with a frame around it.
Qt::WindowFullScreen 0x00000004 The window fills the entire screen without any frame around it.
Qt::WindowActive 0x00000008 The window is the active window, i.e. it has keyboard focus.

3、设置固定大小

this->setFixeSize(this->width(),this-Lheight());

原文地址:https://www.cnblogs.com/judes/p/6667945.html