EditorManager: Native dialogs on macOS can't change their buttons

In this case we try to add a menu to a button.
"Native" is the default, so explicitly request a non-native message
box.

This is the message box that pops up e.g. when trying to open an
empty file foo.ui (the widget designer rejects to open it, Qt Creator provides the option to open with a different editor in the error dialog).

Task-number: QTBUG-118419
Change-Id: Iab3ee14593a55c2056303cfa16b99cea25893522
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Eike Ziller
2023-10-19 15:44:57 +02:00
parent f401d51a66
commit bed9ed55c4

View File

@@ -873,6 +873,9 @@ IEditor *EditorManagerPrivate::openEditor(EditorView *view, const FilePath &file
IEditorFactory *selectedFactory = nullptr;
if (!factories.isEmpty()) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
msgbox.setOptions(QMessageBox::Option::DontUseNativeDialog);
#endif
auto button = qobject_cast<QPushButton *>(msgbox.button(QMessageBox::Open));
QTC_ASSERT(button, return nullptr);
auto menu = new QMenu(button);