plugin: [skip ci] add new signal textChanged() to QuantitySpinBox

This commit is contained in:
wmayer
2020-08-09 11:22:47 +02:00
parent 24f93f94ed
commit 22bfd76efd
4 changed files with 30 additions and 10 deletions

View File

@@ -640,7 +640,7 @@ void QuantitySpinBox::updateFromCache(bool notify)
if (d->pendingEmit) {
double factor;
const Base::Quantity& res = d->cached;
getUserString(res, factor, d->unitStr);
QString text = getUserString(res, factor, d->unitStr);
d->unitValue = res.getValue() / factor;
d->quantity = res;
@@ -649,6 +649,7 @@ void QuantitySpinBox::updateFromCache(bool notify)
d->pendingEmit = false;
valueChanged(res);
valueChanged(res.getValue());
textChanged(text);
}
}
}
@@ -670,8 +671,12 @@ void QuantitySpinBox::setUnit(const Base::Unit &unit)
void QuantitySpinBox::setUnitText(const QString& str)
{
Base::Quantity quant = Base::Quantity::parse(str);
setUnit(quant.getUnit());
try {
Base::Quantity quant = Base::Quantity::parse(str);
setUnit(quant.getUnit());
}
catch (const Base::Exception&) {
}
}
QString QuantitySpinBox::unitText(void)