summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-11-10 14:45:37 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-11-11 17:48:50 +0100
commitc1088d493ea6255ead844505c5d5676362f00684 (patch)
treef6cbbbece0eedf4a19bec22f34a2c67a116649f4 /src/widgets/dialogs
parentb7f621ccadbac0f329c773913769e68db5efef38 (diff)
QMessageBox: Don't add details button to native dialog helper
The "Show Details..." button is not plumbed in any way to the native dialog, so when added to a native dialog it will just result in the dialog being dismissed, instead of revealing any extra content in the native dialog. Both the iOS and Android native message dialog implementations add the details text directly to the dialog, without any action to explicitly reveal it. Task-number: QTBUG-108153 Change-Id: I92e00c59b7836f633be44caebd534a47ac58be00 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 28bf9b0c03..581bc3f93c 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -843,8 +843,12 @@ void QMessageBox::addButton(QAbstractButton *button, ButtonRole role)
if (!button)
return;
removeButton(button);
- d->options->addButton(button->text(), static_cast<QPlatformDialogHelper::ButtonRole>(role),
- button);
+ // Add button to native dialog helper, unless it's the details button,
+ // since we don't do any plumbing for the button's action in that case.
+ if (button != d->detailsButton) {
+ d->options->addButton(button->text(),
+ static_cast<QPlatformDialogHelper::ButtonRole>(role), button);
+ }
d->buttonBox->addButton(button, (QDialogButtonBox::ButtonRole)role);
d->customButtonList.append(button);
d->autoAddOkButton = false;