From c5cbb864d8fd212966b5a0e9aa1e333dd9d44ab2 Mon Sep 17 00:00:00 2001 From: karliss Date: Mon, 24 Mar 2025 23:18:40 +0200 Subject: [PATCH] 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 --- src/Mod/PartDesign/Gui/TaskHoleParameters.cpp | 14 +++++++++++--- src/Mod/PartDesign/Gui/TaskHoleParameters.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp index d690da3512..658b3314f9 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp @@ -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()) { 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 diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.h b/src/Mod/PartDesign/Gui/TaskHoleParameters.h index a3f2e30c62..1af45a2d41 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.h +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.h @@ -126,6 +126,7 @@ protected: private: void onSelectionChanged(const Gui::SelectionChanges &msg) override; + void updateHoleCutLimits(PartDesign::Hole* hole); private: