
在QDialog构造函数中添加以下几行代码:
// 设置窗体最大化和最小化
Qt::WindowFlags windowFlag = Qt::Dialog;
windowFlag |= Qt::WindowMinimizeButtonHint;
windowFlag |= Qt::WindowMaximizeButtonHint;
windowFlag |= Qt::WindowCloseButtonHint;
setWindowFlags(windowFlag);
运行效果:










![[JAVAee]Tomcat - Servlet](https://img-blog.csdnimg.cn/aec8faa8b01342a6be738d903e8ec86b.png)









