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