From ec3c905b6b62934ebafcce1a3c95c4dea43f7792 Mon Sep 17 00:00:00 2001 From: 0penBrain <48731257+0penBrain@users.noreply.github.com> Date: Mon, 28 Mar 2022 19:20:14 +0200 Subject: [PATCH] Gui: fix (another) algorithmic issue in number format change 'localeIndex' shall be updated not only at settings loading but each time settings are saved, otherwise it can lead to unexpected behavior (number format not took into account) when changing number format back and forth and only using 'Apply' button. --- src/Gui/DlgGeneralImp.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Gui/DlgGeneralImp.cpp b/src/Gui/DlgGeneralImp.cpp index c184f74352..6b1321ca12 100644 --- a/src/Gui/DlgGeneralImp.cpp +++ b/src/Gui/DlgGeneralImp.cpp @@ -138,8 +138,9 @@ void DlgGeneralImp::setNumberLocale(bool force/* = false*/) { int localeFormat = ui->UseLocaleFormatting->currentIndex(); - // Only make the change if locale setting has changed - if (!force && localeIndex == localeFormat) + // Only make the change if locale setting has changed or if forced + // Except if format is "OS" where we don't want to run setLocale + if (localeIndex == localeFormat && (!force || localeFormat == 0)) return; if (localeFormat == 0) { @@ -152,6 +153,10 @@ void DlgGeneralImp::setNumberLocale(bool force/* = false*/) else if (localeFormat == 2) { Translator::instance()->setLocale("C"); } + else { + return; // Prevent localeIndex updating if localeFormat is out of range + } + localeIndex = localeFormat; } void DlgGeneralImp::saveSettings()