Gui: fix hot change of locale for QuantitySpinBox

This commit is contained in:
0penBrain
2022-02-24 14:04:16 +01:00
committed by Uwe
parent e3bc06a341
commit c164e2210d

View File

@@ -139,7 +139,7 @@ public:
{
try {
QString copy = str;
copy.remove(locale.groupSeparator());
copy.remove(QLocale().groupSeparator());
result = Base::Quantity::parse(copy);
value = result.getValue();
@@ -162,6 +162,8 @@ 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;
@@ -290,7 +292,6 @@ end:
return res;
}
QLocale locale;
bool validInput;
bool pendingEmit;
QString validStr;
@@ -313,7 +314,6 @@ 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)));