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.
This commit is contained in:
0penBrain
2022-03-28 19:20:14 +02:00
committed by wwmayer
parent c6ea26a70c
commit 32f6443bd4

View File

@@ -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()