Gui: update gizmo state based on new property

This commit is contained in:
captain0xff
2025-09-10 19:49:11 +05:30
committed by Kacper Donat
parent 1f96b30832
commit 603e0bc6e5
2 changed files with 13 additions and 8 deletions

View File

@@ -88,7 +88,7 @@ bool Gizmo::getVisibility() {
LinearGizmo::LinearGizmo(QuantitySpinBox* property)
{
setProperty(property);
this->property = property;
}
SoInteractionKit* LinearGizmo::initDragger()
@@ -118,8 +118,6 @@ SoInteractionKit* LinearGizmo::initDragger()
dragger->labelVisible = false;
setDragLength(property->value().getValue());
dragger->instantiateBaseGeometry();
// change the dragger dimensions
@@ -129,6 +127,8 @@ SoInteractionKit* LinearGizmo::initDragger()
updateColorTheme();
setProperty(property);
return draggerContainer;
}
@@ -170,7 +170,6 @@ void LinearGizmo::reverseDir() {
getDraggerContainer()->setPointerDirection(dir * -1);
}
double LinearGizmo::getDragLength()
{
double dragLength = dragger->translationIncrementCount.getValue()
@@ -217,6 +216,10 @@ void LinearGizmo::setProperty(QuantitySpinBox* property)
setVisibility(visible);
}
);
// Updates the gizmo state based on the new property
setDragLength(property->rawValue());
setVisibility(visible);
}
void LinearGizmo::setMultFactor(const double val)
@@ -269,7 +272,7 @@ void LinearGizmo::draggingContinued()
RotationGizmo::RotationGizmo(QuantitySpinBox* property)
{
setProperty(property);
this->property = property;
}
RotationGizmo::~RotationGizmo()
@@ -312,7 +315,7 @@ SoInteractionKit* RotationGizmo::initDragger()
this
);
setRotAngle(property->value().getValue());
setProperty(property);
updateColorTheme();
@@ -502,6 +505,10 @@ void RotationGizmo::setProperty(QuantitySpinBox* property)
setVisibility(visible);
}
);
// Updates the gizmo state based on the new property
setRotAngle(property->rawValue());
setVisibility(visible);
}
void RotationGizmo::setMultFactor(const double val)

View File

@@ -367,7 +367,6 @@ void TaskChamferParameters::setupGizmos(ViewProviderDressUp* vp)
angleGizmo->setVisibility(false);
secondDistanceGizmo->setProperty(ui->chamferSize);
secondDistanceGizmo->setDragLength(ui->chamferSize->value().getValue());
break;
case Part::ChamferType::twoDistances:
@@ -375,7 +374,6 @@ void TaskChamferParameters::setupGizmos(ViewProviderDressUp* vp)
angleGizmo->setVisibility(false);
secondDistanceGizmo->setProperty(ui->chamferSize2);
secondDistanceGizmo->setDragLength(ui->chamferSize2->value().getValue());
break;
case Part::ChamferType::distanceAngle: