diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index e0edfe4e03..f55113b3ca 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1729,11 +1729,14 @@ static QMessageBox::StandardButton showNewMessageBox(QWidget *parent, { // necessary for source compatibility with Qt 4.0 and 4.1 // handles (Yes, No) and (Yes|Default, No) - if (defaultButton && !(buttons & defaultButton)) - return (QMessageBox::StandardButton) - QMessageBoxPrivate::showOldMessageBox(parent, icon, title, - text, int(buttons), - int(defaultButton), 0); + if (defaultButton && !(buttons & defaultButton)) { + const int defaultButtons = defaultButton | QMessageBox::Default; + const int otherButtons = static_cast(buttons); + const int ret = QMessageBoxPrivate::showOldMessageBox(parent, icon, title, + text, otherButtons, + defaultButtons, 0); + return static_cast(ret); + } QMessageBox msgBox(icon, title, text, QMessageBox::NoButton, parent); QDialogButtonBox *buttonBox = msgBox.findChild();