diff --git a/src/Gui/InputField.cpp b/src/Gui/InputField.cpp index fb0aec5731..d03a521d4d 100644 --- a/src/Gui/InputField.cpp +++ b/src/Gui/InputField.cpp @@ -95,9 +95,6 @@ InputField::InputField(QWidget * parent) QObject::connect(this, SIGNAL(textChanged(QString)), this, SLOT(newInput(QString))); -#ifdef FC_OS_WIN32 - setLocale(QLocale()); -#endif } InputField::~InputField() diff --git a/src/Gui/Language/Translator.cpp b/src/Gui/Language/Translator.cpp index eaa4148e6e..ec91bff293 100644 --- a/src/Gui/Language/Translator.cpp +++ b/src/Gui/Language/Translator.cpp @@ -28,6 +28,7 @@ # include # include # include +# include #endif #include @@ -275,9 +276,9 @@ void Translator::setSystemLocale() const void Translator::updateLocaleChange() const { - // Need to manually send the event so locale change is fully took into account on widgets - auto ev = QEvent(QEvent::LocaleChange); - qApp->sendEvent(qApp, &ev); + for (auto &topLevelWidget: qApp->topLevelWidgets()) { + topLevelWidget->setLocale(QLocale()); + } } QStringList Translator::directories() const diff --git a/src/Gui/QuantitySpinBox.cpp b/src/Gui/QuantitySpinBox.cpp index d503c3625d..fc13b9ad51 100644 --- a/src/Gui/QuantitySpinBox.cpp +++ b/src/Gui/QuantitySpinBox.cpp @@ -139,7 +139,7 @@ public: { try { QString copy = str; - copy.remove(QLocale().groupSeparator()); + copy.remove(locale.groupSeparator()); result = Base::Quantity::parse(copy); value = result.getValue(); @@ -162,8 +162,6 @@ public: const bool plus = max >= 0; const bool minus = min <= 0; - auto locale = QLocale(); - switch (len) { case 0: state = max != min ? QValidator::Intermediate : QValidator::Invalid; @@ -292,6 +290,7 @@ end: return res; } + QLocale locale; bool validInput; bool pendingEmit; QString validStr; @@ -314,6 +313,7 @@ QuantitySpinBox::QuantitySpinBox(QWidget *parent) ExpressionSpinBox(this), d_ptr(new QuantitySpinBoxPrivate(this)) { + d_ptr->locale = locale(); this->setContextMenuPolicy(Qt::DefaultContextMenu); QObject::connect(lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(userInput(QString)));