MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / parse

Method parse

src/Tools/plugins/widget/customwidgets.cpp:651–665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

649{}
650
651Quantity Quantity::parse(const QString& str)
652{
653 bool ok;
654 QString txt = str;
655 QString unit;
656 while (!txt.isEmpty() && txt[txt.length() - 1].isLetter()) {
657 unit.prepend(txt[txt.length() - 1]);
658 txt.chop(1);
659 }
660
661 double v = QLocale::system().toDouble(txt, &ok);
662 // if (!ok && !txt.isEmpty())
663 // throw Base::Exception();
664 return Quantity(v, Unit(unit));
665}
666
667void Quantity::setValue(double v)
668{

Callers 15

getFilesListFunction · 0.45
extractInfoMethod · 0.45
public_stub_symbolsFunction · 0.45
module_support_sourceFunction · 0.45
merge_overlay_moduleFunction · 0.45
lint_stub_fileFunction · 0.45
parse_python_sourceFunction · 0.45

Calls 6

QuantityClass · 0.70
UnitClass · 0.70
isEmptyMethod · 0.45
lengthMethod · 0.45
prependMethod · 0.45
toDoubleMethod · 0.45

Tested by

no test coverage detected