refactor(PD): reduce the number of comparisons

This commit is contained in:
Alfredo Monclus
2024-09-13 05:34:23 -03:00
parent eb886449c2
commit dff79b6b08

View File

@@ -1700,15 +1700,17 @@ void Hole::onChanged(const App::Property* prop)
}
else if (prop == &DepthType) {
std::string DepthMode(DepthType.getValueAsString());
Depth.setReadOnly(DepthMode != "Dimension");
DrillPoint.setReadOnly(DepthMode != "Dimension");
DrillPointAngle.setReadOnly(DepthMode != "Dimension");
DrillForDepth.setReadOnly(DepthMode != "Dimension");
bool isNotDimension = (DepthMode != "Dimension");
Depth.setReadOnly(isNotDimension);
DrillPoint.setReadOnly(isNotDimension);
DrillPointAngle.setReadOnly(isNotDimension);
DrillForDepth.setReadOnly(isNotDimension);
if (!isRestoring()) {
if (DepthMode != "Dimension") {
if (isNotDimension) {
// if through all, set the depth accordingly
Depth.setValue(getThroughAllLength());
// the thread depth is not dimension, it is the same as the hole depth
ThreadDepth.setValue(getThroughAllLength());
}
updateThreadDepthParam();