aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickdialogbuttonbox.cpp
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2020-02-03 12:20:08 +0100
committerMitch Curtis <mitch.curtis@qt.io>2020-02-03 12:34:47 +0100
commitb10912ba731144e8c41cbfa35fb1553ad04b2b88 (patch)
tree9c9b7c8ad5afc1ab8eae72ee120a7c2b6113d7e2 /src/quicktemplates2/qquickdialogbuttonbox.cpp
parent91eb563b278ca9c831c444380030c458adbf02f0 (diff)
DialogButtonBox: don't change button text that has been explicitly set
If a custom button is declared in a DialogButtonBox, qsTr() will take care of translation, and so we shouldn't touch it. Amends c18c7bd7f9596e5ad3d13876a91203e1ceba2544. Change-Id: I06221002cf850882f5318cf0a3ed86da35274d0c Fixes: QTBUG-81796 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickdialogbuttonbox.cpp')
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
index 33b720ed..d448aeed 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox.cpp
+++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp
@@ -455,8 +455,11 @@ void QQuickDialogButtonBoxPrivate::updateLanguage()
qmlAttachedPropertiesObject<QQuickDialogButtonBox>(button, true));
const auto boxAttachedPrivate = QQuickDialogButtonBoxAttachedPrivate::get(attached);
const QPlatformDialogHelper::StandardButton standardButton = boxAttachedPrivate->standardButton;
- const QString buttonText = QGuiApplicationPrivate::platformTheme()->standardButtonText(standardButton);
- button->setText(QPlatformTheme::removeMnemonics(buttonText));
+ // The button might be a custom one with explicitly specified text, so we shouldn't change it in that case.
+ if (standardButton != QPlatformDialogHelper::NoButton) {
+ const QString buttonText = QGuiApplicationPrivate::platformTheme()->standardButtonText(standardButton);
+ button->setText(QPlatformTheme::removeMnemonics(buttonText));
+ }
}
--i;
}