From b10912ba731144e8c41cbfa35fb1553ad04b2b88 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 3 Feb 2020 12:20:08 +0100 Subject: 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 --- src/quicktemplates2/qquickdialogbuttonbox.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/quicktemplates2/qquickdialogbuttonbox.cpp') 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(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; } -- cgit v1.2.3