| 172 | } |
| 173 | |
| 174 | void InputField::updateText(const Base::Quantity& quant) |
| 175 | { |
| 176 | if (isBound()) { |
| 177 | std::shared_ptr<const Expression> e( |
| 178 | getPath().getDocumentObject()->getExpression(getPath()).expression |
| 179 | ); |
| 180 | |
| 181 | if (e) { |
| 182 | setText(QString::fromStdString(e->toString())); |
| 183 | return; |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | double dFactor; |
| 188 | std::string unitStr; |
| 189 | std::string txt = quant.getUserString(dFactor, unitStr); |
| 190 | actUnitValue = quant.getValue() / dFactor; |
| 191 | // Block signals to prevent newInput from re-parsing the display text |
| 192 | // and overwriting actQuantity with a precision-truncated value. |
| 193 | QSignalBlocker blocker(this); |
| 194 | setText(QString::fromStdString(txt)); |
| 195 | } |
| 196 | |
| 197 | void InputField::notifyValueChanged() |
| 198 | { |
nothing calls this directly
no test coverage detected