From 23f7c163f5489f3360f375994f7d34ef4fb9ec4d Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 27 Mar 2023 11:56:03 +0200 Subject: [PATCH] Gui: add method isEnabledDecimalPointConversion() to Translator and use it in DlgGeneralImp::setDecimalPointConversion to fix annoying warning in debug builds --- src/Gui/DlgGeneralImp.cpp | 7 +++++-- src/Gui/Language/Translator.cpp | 5 +++++ src/Gui/Language/Translator.h | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Gui/DlgGeneralImp.cpp b/src/Gui/DlgGeneralImp.cpp index 651c4123c5..6cda4c88bc 100644 --- a/src/Gui/DlgGeneralImp.cpp +++ b/src/Gui/DlgGeneralImp.cpp @@ -167,8 +167,11 @@ void DlgGeneralImp::setNumberLocale(bool force/* = false*/) localeIndex = localeFormat; } -void DlgGeneralImp::setDecimalPointConversion(bool on) { - Translator::instance()->enableDecimalPointConversion(on); +void DlgGeneralImp::setDecimalPointConversion(bool on) +{ + if (Translator::instance()->isEnabledDecimalPointConversion() != on) { + Translator::instance()->enableDecimalPointConversion(on); + } } void DlgGeneralImp::saveSettings() diff --git a/src/Gui/Language/Translator.cpp b/src/Gui/Language/Translator.cpp index 1e272555c9..9bae4edf6b 100644 --- a/src/Gui/Language/Translator.cpp +++ b/src/Gui/Language/Translator.cpp @@ -415,4 +415,9 @@ void Translator::enableDecimalPointConversion(bool on) } } +bool Translator::isEnabledDecimalPointConversion() const +{ + return static_cast(decimalPointConverter); +} + #include "moc_Translator.cpp" diff --git a/src/Gui/Language/Translator.h b/src/Gui/Language/Translator.h index f7a9735707..92f84ff87d 100644 --- a/src/Gui/Language/Translator.h +++ b/src/Gui/Language/Translator.h @@ -80,6 +80,8 @@ public: bool eventFilter(QObject* obj, QEvent* ev); /** Enables/disables decimal separator conversion **/ void enableDecimalPointConversion(bool on); + /** Returns whether decimal separator conversion is enabled */ + bool isEnabledDecimalPointConversion() const; private: Translator();