65,209
社区成员
发帖
与我相关
我的任务
分享
Qt::WindowFlags flags = Qt::Dialog;
flags |= Qt::WindowMinimizeButtonHint;
flags |= Qt::WindowMaximizeButtonHint;
flags |= Qt::WindowCloseButtonHint;
setWindowFlags(flags);
QWizardPage* page1 = new QWizardPage;
QWizardPage* page2 = new QWizardPage;
addPage(page1);
addPage(page2);
setWizardStyle(QWizard::ModernStyle);
setWindowTitle(tr("test wizard"));
Qt::WindowFlags flags = Qt::Dialog;
flags |= Qt::CustomizeWindowHint; //就是这句!
flags |= Qt::WindowMinimizeButtonHint;
flags |= Qt::WindowMaximizeButtonHint;
flags |= Qt::WindowCloseButtonHint;
setWindowFlags(flags);
QWizardPage* page1 = new QWizardPage;
QWizardPage* page2 = new QWizardPage;
addPage(page1);
addPage(page2);
setWizardStyle(QWizard::ModernStyle);
setWindowTitle(tr("test wizard"));
这样就好用了,通过查看文档可知原因:The CustomizeWindowHint flag is used to enable customization of the window controls. This flag must be set to allow the WindowTitleHint, WindowSystemMenuHint, WindowMinimizeButtonHint, WindowMaximizeButtonHint and WindowCloseButtonHint flags to be changed.
另,请参考:http://stackoverflow.com/questions/27496686/cant-hide-or-disable-the-close-button-on-qwizard