register Quantity type for shiboken2, handle exception to fix abort when setting quantity property of InputField via Python

This commit is contained in:
wmayer
2016-12-30 22:51:17 +01:00
parent 39ddebc337
commit 4db41b0b4b
2 changed files with 8 additions and 7 deletions

View File

@@ -492,8 +492,13 @@ void InputField::setMinimum(double m)
void InputField::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 (...) {
// ignore exceptions
}
}
QString InputField::getUnitText(void)