From 4062a15018fb8ed926aac6b08e61b02461d4d1b5 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 6 Aug 2016 19:08:27 +0200 Subject: [PATCH] use QuantityFormat to restore old behaviour for dimensionsal constraints of sketches --- src/Mod/Sketcher/App/Constraint.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/Mod/Sketcher/App/Constraint.cpp b/src/Mod/Sketcher/App/Constraint.cpp index f80498d4a0..1f846b7402 100644 --- a/src/Mod/Sketcher/App/Constraint.cpp +++ b/src/Mod/Sketcher/App/Constraint.cpp @@ -135,23 +135,33 @@ double Constraint::getValue() const Quantity Constraint::getPresentationValue() const { + Quantity quantity; switch (Type) { case Distance: case Radius: - return Quantity(Value, Unit::Length); case DistanceX: case DistanceY: - if (FirstPos == Sketcher::none || Second != Sketcher::Constraint::GeoUndef) - return Quantity(Value, Unit::Length); - else - return Quantity(Value, Unit::Length); + quantity.setValue(Value); + quantity.setUnit(Unit::Length); + break; case Angle: - return Quantity(toDegrees(Value), Unit::Angle); + quantity.setValue(toDegrees(Value)); + quantity.setUnit(Unit::Angle); + break; case SnellsLaw: - return Value; + quantity.setValue(Value); + break; default: - return Value; + quantity.setValue(Value); + break; } + + QuantityFormat format = quantity.getFormat(); + format.option = QuantityFormat::None; + format.format = QuantityFormat::Default; + format.precision = 6; // QString's default + quantity.setFormat(format); + return quantity; } unsigned int Constraint::getMemSize (void) const