diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2020-02-03 12:20:08 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2020-02-03 12:34:47 +0100 |
commit | b10912ba731144e8c41cbfa35fb1553ad04b2b88 (patch) | |
tree | 9c9b7c8ad5afc1ab8eae72ee120a7c2b6113d7e2 /src | |
parent | 91eb563b278ca9c831c444380030c458adbf02f0 (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')
-rw-r--r-- | src/quicktemplates2/qquickdialogbuttonbox.cpp | 7 |
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; } |