[Interest] QMessageBox - Accept/Reject

Igor Mironchik igor.mironchik at gmail.com
Fri Apr 28 20:23:02 CEST 2017


Hello,

Following code:

QMessageBoxdlg(this);

dlg.setText(tr("Wouldyouliketosaveconfiguration?"));

QPushButton*btn=dlg.addButton(tr("Yes"),QMessageBox::AcceptRole);

dlg.addButton(tr("No"),QMessageBox::RejectRole);

dlg.setDefaultButton(btn);

intret=dlg.exec();

qDebug()<<ret;

prints 0 when I press "Yes" button and 1 when I press "No" button. That is inverted
with QDialog::DialogCode.

Is it a known bug? Or I missed something?

Thank you.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170428/10a7b184/attachment.html>


More information about the Interest mailing list