diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 5d0c84e9d4..ca7af90c15 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -2824,7 +2824,7 @@ bool QMessageBoxPrivate::canBeNativeDialog() const if (strcmp(QMessageBox::staticMetaObject.className(), q->metaObject()->className()) != 0) return false; - for (auto *customButton : customButtonList) { + for (auto *customButton : buttonBox->buttons()) { if (QPushButton *pushButton = qobject_cast(customButton)) { // We can't support buttons with menus in native dialogs (yet) if (pushButton->menu())