simplify handling of locale specific with InputField from Python
This commit is contained in:
@@ -457,6 +457,25 @@ void InputField::setQuantityString(const QString& text)
|
||||
updateText(actQuantity);
|
||||
}
|
||||
|
||||
/// return the quantity in C locale, i.e. decimal separator is a dot.
|
||||
QString InputField::rawText(void) const
|
||||
{
|
||||
double factor;
|
||||
QString unit;
|
||||
double value = actQuantity.getValue();
|
||||
actQuantity.getUserString(factor, unit);
|
||||
return QString::fromLatin1("%1 %2").arg(value / factor).arg(unit);
|
||||
}
|
||||
|
||||
/// expects the string in C locale and internally converts it into the OS-specific locale
|
||||
void InputField::setRawText(const QString& text)
|
||||
{
|
||||
Base::Quantity quant = Base::Quantity::parse(text);
|
||||
// Input and then format the quantity
|
||||
newInput(quant.getUserString());
|
||||
updateText(actQuantity);
|
||||
}
|
||||
|
||||
/// get the value of the singleStep property
|
||||
double InputField::singleStep(void)const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user