| 559 | } |
| 560 | |
| 561 | bool QuantitySpinBox::isNormalized() |
| 562 | { |
| 563 | static const QRegularExpression operators( |
| 564 | QStringLiteral("[+\\-/*]"), |
| 565 | QRegularExpression::CaseInsensitiveOption |
| 566 | ); |
| 567 | |
| 568 | Q_D(const QuantitySpinBox); |
| 569 | |
| 570 | // this check is two level |
| 571 | // 1. We consider every string that does not contain operators as normalized |
| 572 | // 2. If it does contain operators we check if it differs from normalized input - as some |
| 573 | // operators like - can be allowed even in normalized case. |
| 574 | return !d->validStr.contains(operators) |
| 575 | || d->validStr.toStdString() == d->quantity.getUserString(); |
| 576 | } |
| 577 | |
| 578 | void QuantitySpinBox::setValue(const Base::Quantity& value) |
| 579 | { |
no test coverage detected