summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-10-22 16:22:27 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-10-26 00:14:33 +0200
commitb0ddca18d73430771f52c034e3d5a1bb92363f64 (patch)
treea9535aefc597a055e3c8946c9a173f67858ee38b /src/plugins/platforms/cocoa
parent1b0e76f514e9a460e1d78a813813c0909838a03e (diff)
QMessageBox: Do last minute setup in setVisible instead of showEvent
The native message dialogs are shown in QMessageBox::setVisible, instead of plumbed via e.g. QWidgetPrivate::show_sys (which is not virtual). And we try to show the native dialog before we call the base class QDialog::setVisible(), where we end up sending the show event. As the native dialogs might rely on the last minute setup of adding an OK button or detecting the escape button, we need to do it in setVisible instead. We can not switch the order of showing the native dialogs after calling the base class setVisible (and getting showEvent), as we need to know whether the native dialog could be shown or not to decide whether to show the fallback widget dialog. The part from showEvent that added the detailsButton has been removed, as we're already doing that in setDetailsText(). Pick-to: 6.5 6.6 Change-Id: I23f1d87d542d9dadfd71924f8119c22720f4b276 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qcocoamessagedialog.mm10
1 files changed, 0 insertions, 10 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamessagedialog.mm b/src/plugins/platforms/cocoa/qcocoamessagedialog.mm
index 23620a4bd7..cc1e8a98f2 100644
--- a/src/plugins/platforms/cocoa/qcocoamessagedialog.mm
+++ b/src/plugins/platforms/cocoa/qcocoamessagedialog.mm
@@ -189,16 +189,6 @@ bool QCocoaMessageDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality w
for (auto customButton : customButtons)
addButton(customButton.label, customButton.id, customButton.role);
-
- // QMessageDialog's logic for adding a fallback OK button if no other buttons
- // are added depends on QMessageBox::showEvent(), which is too late when
- // native dialogs are in use. To ensure there's always an OK button with a tag
- // we recognize we add it explicitly here as a fallback.
- if (!m_alert.buttons.count) {
- addButton(platformTheme->standardButtonText(StandardButton::Ok),
- StandardButton::Ok, ButtonRole::AcceptRole);
- }
-
if (auto checkBoxLabel = options()->checkBoxLabel(); !checkBoxLabel.isNull()) {
checkBoxLabel = QPlatformTheme::removeMnemonics(checkBoxLabel);
m_alert.suppressionButton.title = checkBoxLabel.toNSString();