PDA

View Full Version : QMessageBox disabled the close button when you setStandardButtons(NoButton)!



koilin
1st August 2012, 11:34
I have a QMessageBox, when I did the


QMessageBox myBox = new QMessageBox();
myBox.setStandardButtons(NoButton);
myBox.exec();

the dialog's close button(on the upright corner of the dialog) will turn to be disable.
How to enable the close button?

spirit
3rd August 2012, 13:06
Play with window flags (http://qt-project.org/doc/qt-4.8/qwidget.html#windowFlags-prop).

sonulohani
3rd August 2012, 13:08
Use:->

myBox.setStandardButtons(QMessageBox::Close);


If you dont want anything on the widget then simply define one QWidget with empty widgets.