PartDesign: Update counterbore min size in reaction to diameter changes (#20217)

Can't rely purely on `TaskHoleParameters::threadDiameterChanged` to update it since the signal is intentionally blocked while syncing state to GUI.

Closes #19744
This commit is contained in:
karliss
2025-03-24 23:18:40 +02:00
committed by GitHub
parent 0206ff59cd
commit f0fe00e16a
2 changed files with 12 additions and 3 deletions

View File

@@ -128,7 +128,7 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole* HoleView, QWidget* pare
|| pcHole->HoleCutCustomValues.isReadOnly()
);
// HoleCutDiameter must not be smaller or equal than the Diameter
ui->HoleCutDiameter->setMinimum(pcHole->Diameter.getValue() + 0.1);
updateHoleCutLimits(pcHole);
ui->HoleCutDiameter->setValue(pcHole->HoleCutDiameter.getValue());
ui->HoleCutDiameter->setDisabled(pcHole->HoleCutDiameter.isReadOnly());
ui->HoleCutDepth->setValue(pcHole->HoleCutDepth.getValue());
@@ -731,8 +731,7 @@ void TaskHoleParameters::threadDiameterChanged(double value)
if (auto hole = getObject<PartDesign::Hole>()) {
hole->Diameter.setValue(value);
// HoleCutDiameter must not be smaller or equal than the Diameter
ui->HoleCutDiameter->setMinimum(value + 0.1);
updateHoleCutLimits(hole);
recomputeFeature();
}
@@ -838,6 +837,7 @@ void TaskHoleParameters::changedObject(const App::Document&, const App::Property
else if (&Prop == &hole->Diameter) {
ui->Diameter->setEnabled(true);
updateSpinBox(ui->Diameter, hole->Diameter.getValue());
updateHoleCutLimits(hole);
}
else if (&Prop == &hole->ThreadDirection) {
ui->directionRightHand->setEnabled(true);
@@ -1130,6 +1130,14 @@ void TaskHoleParameters::apply()
isApplying = false;
}
void TaskHoleParameters::updateHoleCutLimits(PartDesign::Hole* hole)
{
constexpr double minHoleCutDifference = 0.1;
// HoleCutDiameter must not be smaller or equal than the Diameter
ui->HoleCutDiameter->setMinimum(hole->Diameter.getValue() + minHoleCutDifference);
}
//**************************************************************************
//**************************************************************************
// TaskDialog

View File

@@ -126,6 +126,7 @@ protected:
private:
void onSelectionChanged(const Gui::SelectionChanges &msg) override;
void updateHoleCutLimits(PartDesign::Hole* hole);
private: