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