| 649 | {} |
| 650 | |
| 651 | Quantity 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 | |
| 667 | void Quantity::setValue(double v) |
| 668 | { |
no test coverage detected