diff --git a/src/Gui/Inventor/Draggers/Gizmo.cpp b/src/Gui/Inventor/Draggers/Gizmo.cpp index ad6bba3988..5e18462ea2 100644 --- a/src/Gui/Inventor/Draggers/Gizmo.cpp +++ b/src/Gui/Inventor/Draggers/Gizmo.cpp @@ -26,6 +26,8 @@ #include "Gizmo.h" #ifndef _PreComp_ +#include + #include #include #include @@ -168,6 +170,7 @@ void LinearGizmo::setDragLength(double dragLength) void LinearGizmo::setGeometryScale(float scale) { dragger->geometryScale = SbVec3f(scale, scale, scale); + dragger->translationIncrement = std::pow(10.0f, std::floor(std::log10(scale))); } SoLinearDraggerContainer* LinearGizmo::getDraggerContainer() @@ -178,9 +181,8 @@ SoLinearDraggerContainer* LinearGizmo::getDraggerContainer() void LinearGizmo::setProperty(QuantitySpinBox* property) { - if (quantityChangedConnection) { - QuantitySpinBox::disconnect(quantityChangedConnection); - } + QuantitySpinBox::disconnect(quantityChangedConnection); + QuantitySpinBox::disconnect(formulaDialogConnection); this->property = property; quantityChangedConnection = QuantitySpinBox::connect( @@ -189,7 +191,7 @@ void LinearGizmo::setProperty(QuantitySpinBox* property) setDragLength(value); } ); - quantityChangedConnection = QuantitySpinBox::connect( + formulaDialogConnection = QuantitySpinBox::connect( property, &Gui::QuantitySpinBox::showFormulaDialog, [this] (bool) { // This will set the visibility of the actual geometry to true or false @@ -452,9 +454,8 @@ void RotationGizmo::orientAlongCamera(SoCamera* camera) void RotationGizmo::setProperty(QuantitySpinBox* property) { - if (quantityChangedConnection) { - QuantitySpinBox::disconnect(quantityChangedConnection); - } + QuantitySpinBox::disconnect(quantityChangedConnection); + QuantitySpinBox::disconnect(formulaDialogConnection); this->property = property; quantityChangedConnection = QuantitySpinBox::connect( @@ -463,7 +464,7 @@ void RotationGizmo::setProperty(QuantitySpinBox* property) setRotAngle(value); } ); - quantityChangedConnection = QuantitySpinBox::connect( + formulaDialogConnection = QuantitySpinBox::connect( property, &Gui::QuantitySpinBox::showFormulaDialog, [this] (bool) { // This will set the visibility of the actual geometry to true or false diff --git a/src/Gui/Inventor/Draggers/Gizmo.h b/src/Gui/Inventor/Draggers/Gizmo.h index a87a98ff19..9a7dc8e5f1 100644 --- a/src/Gui/Inventor/Draggers/Gizmo.h +++ b/src/Gui/Inventor/Draggers/Gizmo.h @@ -85,7 +85,6 @@ protected: double initialValue; bool visible = true; - bool hasExpression = false; }; class GuiExport LinearGizmo: public Gizmo @@ -115,6 +114,7 @@ private: SoLinearDragger* dragger = nullptr; SoLinearDraggerContainer* draggerContainer = nullptr; QMetaObject::Connection quantityChangedConnection; + QMetaObject::Connection formulaDialogConnection; void draggingStarted(); void draggingFinished(); @@ -160,6 +160,7 @@ private: LinearGizmo* linearGizmo = nullptr; bool automaticOrientation = false; QMetaObject::Connection quantityChangedConnection; + QMetaObject::Connection formulaDialogConnection; void draggingStarted(); void draggingFinished();