From d2cb3685d972cd6362a3b62b5354f0bb18a65faf Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Mon, 13 Jan 2025 08:44:09 -0300 Subject: [PATCH 01/12] refactor(PD): hole taskpanel ui open and save with QT designer 5.15 --- src/Mod/PartDesign/Gui/TaskHoleParameters.ui | 68 ++++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui index 120862b336..06fbdb36b9 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui @@ -6,7 +6,7 @@ 0 0 - 394 + 395 702 @@ -136,7 +136,7 @@ Only available for holes without thread - + 0 @@ -146,13 +146,13 @@ Only available for holes without thread Hole diameter - + false mm - + 0.000000000000000 @@ -195,14 +195,14 @@ Only available for holes without thread - + 0 0 - + false @@ -243,8 +243,8 @@ Only available for holes without thread - - + + 0 @@ -257,18 +257,18 @@ Only available for holes without thread under 90: smaller hole radius at the bottom over 90: larger hole radius at the bottom - + false deg - + 0.000000000000000 - + @@ -365,14 +365,14 @@ over 90: larger hole radius at the bottom - + 0 0 - + false @@ -435,7 +435,7 @@ over 90: larger hole radius at the bottom - + @@ -488,7 +488,7 @@ Note that the calculation can take some time - + 0 @@ -498,18 +498,18 @@ Note that the calculation can take some time Custom Thread clearance value - + false mm - + 0.100000000000000 - + @@ -558,7 +558,7 @@ Note that the calculation can take some time - + 0 @@ -568,16 +568,16 @@ Note that the calculation can take some time Qt::NoContextMenu - + false mm - + 0.000000000000000 - + 0.100000000000000 @@ -596,7 +596,7 @@ Note that the calculation can take some time - + 0 @@ -607,16 +607,16 @@ Note that the calculation can take some time For countersinks this is the depth of the screw's top below the surface - + false mm - + 0.000000000000000 - + 0.100000000000000 @@ -635,20 +635,20 @@ the screw's top below the surface - + 0 0 - + false deg - + 0.000000000000000 @@ -725,26 +725,26 @@ the screw's top below the surface - - + + 0 0 - + false deg - + 0.000000000000000 - + From 6f057b0693205d544e12b2d4eb9dea1198a0ee9c Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Mon, 13 Jan 2025 08:42:09 -0300 Subject: [PATCH 02/12] feat(PD): hole taskpanel: hide drill point options if not applicable --- src/Mod/PartDesign/Gui/TaskHoleParameters.cpp | 63 ++++++------------- src/Mod/PartDesign/Gui/TaskHoleParameters.ui | 16 ----- 2 files changed, 18 insertions(+), 61 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp index 5bca81cd1b..59349024a4 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp @@ -134,38 +134,20 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole* HoleView, QWidget* pare ui->DepthType->setCurrentIndex(pcHole->DepthType.getValue()); ui->Depth->setValue(pcHole->Depth.getValue()); - if (pcHole->DrillPoint.getValue() == 0L) { - ui->drillPointFlat->setChecked(true); - } - else { - ui->drillPointAngled->setChecked(true); - } + ui->DrillPointAngle->setMinimum(pcHole->DrillPointAngle.getMinimum()); ui->DrillPointAngle->setMaximum(pcHole->DrillPointAngle.getMaximum()); ui->DrillPointAngle->setValue(pcHole->DrillPointAngle.getValue()); ui->DrillForDepth->setChecked(pcHole->DrillForDepth.getValue()); - // drill point settings are only enabled (sensible) if type is 'Dimension' - if (std::string(pcHole->DepthType.getValueAsString()) == "Dimension") { - ui->drillPointFlat->setEnabled(true); - ui->drillPointAngled->setEnabled(true); - ui->DrillPointAngle->setEnabled(true); - ui->DrillForDepth->setEnabled(true); - } - else { - ui->drillPointFlat->setEnabled(false); - ui->drillPointAngled->setEnabled(false); - ui->DrillPointAngle->setEnabled(false); - ui->DrillForDepth->setEnabled(false); - } - // drill point is sensible but flat, disable angle and option - if (!ui->drillPointFlat->isChecked()) { - ui->DrillPointAngle->setEnabled(true); - ui->DrillForDepth->setEnabled(true); - } - else { - ui->DrillPointAngle->setEnabled(false); - ui->DrillForDepth->setEnabled(false); - } + + bool isFlatDrill = pcHole->DrillPoint.getValue() == 0L; + bool depthIsDimension = std::string(pcHole->DepthType.getValueAsString()) == "Dimension"; + ui->DrillGroupBox->setVisible(depthIsDimension); + ui->drillPointFlat->setChecked(isFlatDrill); + ui->drillPointAngled->setChecked(!isFlatDrill); + ui->DrillPointAngle->setEnabled(!isFlatDrill); + ui->DrillForDepth->setVisible(!isFlatDrill); + ui->Tapered->setChecked(pcHole->Tapered.getValue()); // Angle is only enabled (sensible) if tapered ui->TaperedAngle->setEnabled(pcHole->Tapered.getValue()); @@ -526,23 +508,14 @@ void TaskHoleParameters::depthChanged(int index) hole->DepthType.setValue(index); - // disable drill point widgets if not 'Dimension' - if (std::string(hole->DepthType.getValueAsString()) == "Dimension") { - ui->drillPointFlat->setEnabled(true); - ui->drillPointAngled->setEnabled(true); - ui->DrillPointAngle->setEnabled(true); - ui->DrillForDepth->setEnabled(true); - } - else { // through all - ui->drillPointFlat->setEnabled(false); - ui->drillPointAngled->setEnabled(false); - ui->DrillPointAngle->setEnabled(false); - ui->DrillForDepth->setEnabled(false); - } + bool DepthisDimension = ( + std::string(hole->DepthType.getValueAsString()) == "Dimension" + ); + + ui->DrillGroupBox->setVisible(DepthisDimension); recomputeFeature(); // enabling must be handled after recompute - ui->ThreadDepth->setEnabled(std::string(hole->ThreadDepthType.getValueAsString()) - == "Dimension"); + ui->ThreadDepth->setEnabled(DepthisDimension); } void TaskHoleParameters::depthValueChanged(double value) @@ -558,11 +531,11 @@ void TaskHoleParameters::drillPointChanged() if (auto hole = getObject()) { if (sender() == ui->drillPointFlat) { hole->DrillPoint.setValue(0L); - ui->DrillForDepth->setEnabled(false); + ui->DrillForDepth->setVisible(false); } else if (sender() == ui->drillPointAngled) { hole->DrillPoint.setValue(1L); - ui->DrillForDepth->setEnabled(true); + ui->DrillForDepth->setVisible(true); } else { assert(0); diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui index 06fbdb36b9..2425c6e0a3 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui @@ -974,22 +974,6 @@ account for the depth of blind holes - - drillPointAngled - toggled(bool) - DrillForDepth - setVisible(bool) - - - 112 - 686 - - - 113 - 718 - - - From d30656824d9850004a8c4e65c64ddf9cccb6e271 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Mon, 13 Jan 2025 09:27:20 -0300 Subject: [PATCH 03/12] refactor(PD): hole taskpanel ui move ThreadFit into its own widget near the thread options --- src/Mod/PartDesign/Gui/TaskHoleParameters.ui | 387 ++++++++++--------- 1 file changed, 207 insertions(+), 180 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui index 2425c6e0a3..8c01665b54 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui @@ -7,7 +7,7 @@ 0 0 395 - 702 + 726 @@ -20,33 +20,6 @@ Task Hole Parameters - - - - - - - 0 - 0 - - - - Profile - - - - - - - - 0 - 0 - - - - - - @@ -64,62 +37,6 @@ - - - - - 0 - 0 - - - - - - - - - - - - - 0 - 0 - - - - Clearance - - - - - - - - 0 - 0 - - - - Hole clearance -Only available for holes without thread - - - - Standard - - - - - Close - - - - - Wide - - - - @@ -268,9 +185,213 @@ over 90: larger hole radius at the bottom + + + + + 0 + 0 + + + + - + + + + + + + + + + + + + 0 + 0 + + + + Drill Point + + + + + + + + 0 + 0 + + + + Flat + + + drillPointButtonGroup + + + + + + + + 0 + 0 + + + + Angled + + + drillPointButtonGroup + + + + + + + + 0 + 0 + + + + false + + + deg + + + 0.000000000000000 + + + + + + + + + + 0 + 0 + + + + The size of the drill point will be taken into +account for the depth of blind holes + + + Take into account for depth + + + + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + 0 + 0 + + + + Clearance + + + + + + + + 0 + 0 + + + + Hole clearance +Only available for holes without thread + + + + Standard + + + + + Close + + + + + Wide + + + + + + + + + + + + + + + + 0 + 0 + + + + Profile + + + + + + + + 0 + 0 + + + + + + + @@ -512,7 +633,7 @@ Note that the calculation can take some time - + @@ -672,100 +793,6 @@ the screw's top below the surface - - - - - - - - - - - - - 0 - 0 - - - - Drill Point - - - - - - - - 0 - 0 - - - - Flat - - - drillPointButtonGroup - - - - - - - - 0 - 0 - - - - Angled - - - drillPointButtonGroup - - - - - - - - 0 - 0 - - - - false - - - deg - - - 0.000000000000000 - - - - - - - - - - 0 - 0 - - - - The size of the drill point will be taken into -account for the depth of blind holes - - - Take into account for depth - - - - - - From 884dc96774ff87114a566790a8ff34eeea48ead6 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Mon, 13 Jan 2025 09:36:57 -0300 Subject: [PATCH 04/12] refactor(PD): hole taskpanel ui move Threaded to the grid above --- src/Mod/PartDesign/Gui/TaskHoleParameters.ui | 160 +++++++++---------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui index 8c01665b54..2db6808a96 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui @@ -7,7 +7,7 @@ 0 0 395 - 726 + 732 @@ -22,6 +22,31 @@ + + + + + 0 + 0 + + + + Taper angle for the hole +90 degree: straight hole +under 90: smaller hole radius at the bottom +over 90: larger hole radius at the bottom + + + false + + + deg + + + 0.000000000000000 + + + @@ -39,19 +64,6 @@ - - - - - 0 - 0 - - - - Diameter - - - @@ -74,6 +86,39 @@ + + + + + + + 0 + 0 + + + + Reverses the hole direction + + + Reversed + + + + + + + + 0 + 0 + + + + Tapered + + + + + @@ -127,61 +172,16 @@ - - - - - - - 0 - 0 - - - - Reverses the hole direction - - - Reversed - - - - - - - - 0 - 0 - - - - Tapered - - - - - - - + + - + 0 0 - - Taper angle for the hole -90 degree: straight hole -under 90: smaller hole radius at the bottom -over 90: larger hole radius at the bottom - - - false - - - deg - - - 0.000000000000000 + + Diameter @@ -195,6 +195,22 @@ over 90: larger hole radius at the bottom + + + + + 0 + 0 + + + + Whether the hole gets a thread + + + Threaded + + + @@ -399,22 +415,6 @@ Only available for holes without thread - - - - - 0 - 0 - - - - Whether the hole gets a thread - - - Threaded - - - From c6b68995a0ea0f553ebd8b45d81069b6b2d16089 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Mon, 13 Jan 2025 10:34:41 -0300 Subject: [PATCH 05/12] refactor(PD): hole taskpanel ui reorganize the layout of the thread group to be more manageable --- src/Mod/PartDesign/Gui/TaskHoleParameters.ui | 1058 ++++++++++-------- 1 file changed, 574 insertions(+), 484 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui index 2db6808a96..2c0f859716 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui @@ -6,8 +6,8 @@ 0 0 - 395 - 732 + 432 + 776 @@ -30,6 +30,12 @@ 0 + + + 0 + 20 + + Taper angle for the hole 90 degree: straight hole @@ -50,7 +56,7 @@ over 90: larger hole radius at the bottom - + 0 @@ -72,6 +78,12 @@ over 90: larger hole radius at the bottom 0 + + + 0 + 20 + + Hole diameter @@ -122,7 +134,7 @@ over 90: larger hole radius at the bottom - + 0 @@ -164,6 +176,12 @@ over 90: larger hole radius at the bottom 0 + + + 0 + 20 + + false @@ -173,7 +191,7 @@ over 90: larger hole radius at the bottom - + 0 @@ -213,6 +231,184 @@ over 90: larger hole radius at the bottom + + + + + + + + + + + 0 + 0 + + + + Hole Cut Type + + + + + + + + 0 + 0 + + + + Cut type for screw heads + + + + + + + + 0 + 0 + + + + Diameter + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + Qt::NoContextMenu + + + false + + + mm + + + 0.000000000000000 + + + 0.100000000000000 + + + + + + + + 0 + 0 + + + + Depth + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + For countersinks this is the depth of +the screw's top below the surface + + + false + + + mm + + + 0.000000000000000 + + + 0.100000000000000 + + + + + + + + 0 + 0 + + + + Countersink angle + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + false + + + deg + + + 0.000000000000000 + + + + + + + + 0 + 0 + + + + Check to override the values predefined by the 'Type' + + + Custom values + + + + + + @@ -222,7 +418,7 @@ over 90: larger hole radius at the bottom - + 0 @@ -274,6 +470,12 @@ over 90: larger hole radius at the bottom 0 + + + 0 + 20 + + false @@ -307,206 +509,77 @@ account for the depth of blind holes - - - - - 0 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - 0 - 0 - - - - Clearance - - - - - - - - 0 - 0 - - - - Hole clearance -Only available for holes without thread - - - - Standard - - - - - Close - - - - - Wide - - - - - - - - - - - - - - - - 0 - 0 - - - - Profile - - - - - - - - 0 - 0 - - - - - - - - - - - - - - 0 - 0 - - - - Class - - - - - - - - - - 0 - 0 - - - - Tolerance class for threaded holes according to hole profile - + + + 6 + + + 6 + + + 6 + + + 6 + + + 6 + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Class + + + + + + + + 0 + 0 + + + + Tolerance class for threaded holes according to hole profile + + + + - - - - - - - 0 - 0 - - - - Depth - - - - - - - - 0 - 0 - - - - - Hole depth - - - - - Dimension - - - - - Tapped (DIN76) - - - - - - - - - - - 0 - 0 - - - - false - - - mm - - - - + - + - + 0 0 @@ -535,112 +608,286 @@ Only available for holes without thread + + + + + 0 + 0 + + + + + + + Right hand + + + directionButtonGroup + + + - - - - - 0 - 0 - + + + + 0 - - + + 0 - - Right hand - - - directionButtonGroup - - - - - - - - 0 - 0 - - - - Whether the hole gets a modelled thread - - - Model Thread - - - - - - - true - - - - 0 - 0 - - - - Live update of changes to the thread + + + + + 0 + 0 + + + + Whether the hole gets a modelled thread + + + Model Thread + + + + + + + true + + + + 0 + 0 + + + + Live update of changes to the thread Note that the calculation can take some time - - - Update thread view - + + + Update thread view + + + + + + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 6 + + + 0 + + + + + + 0 + 0 + + + + Depth + + + + + + + + 0 + 0 + + + + + Hole depth + + + + + Dimension + + + + + Tapped (DIN76) + + + + + + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + false + + + mm + + + + + + - - - - - 0 - 0 - - - - Customize thread clearance - - - Custom Clearance - - - - - - - - 0 - 0 - - - - Custom Thread clearance value - - - false - - - mm - - - 0.100000000000000 - + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Customize thread clearance + + + Custom Clearance + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + Custom Thread clearance value + + + false + + + mm + + + 0.100000000000000 + + + + - - - - + + + + + + + 0 + 0 + + + + Profile + + + + + + + + 0 + 0 + + + + + + + + + + + 0 + 0 + - - - + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 @@ -648,146 +895,37 @@ Note that the calculation can take some time - Hole Cut Type + Clearance - - + + - + 0 0 - Cut type for screw heads - - - - - - - - 0 - 0 - - - - Diameter - - - - - - - - 0 - 0 - - - - Qt::NoContextMenu - - - false - - - mm - - - 0.000000000000000 - - - 0.100000000000000 - - - - - - - - 0 - 0 - - - - Depth - - - - - - - - 0 - 0 - - - - For countersinks this is the depth of -the screw's top below the surface - - - false - - - mm - - - 0.000000000000000 - - - 0.100000000000000 - - - - - - - - 0 - 0 - - - - Countersink angle - - - - - - - - 0 - 0 - - - - false - - - deg - - - 0.000000000000000 - - - - - - - - 0 - 0 - - - - Check to override the values predefined by the 'Type' - - - Custom values + Hole clearance +Only available for holes without thread + + + Standard + + + + + Close + + + + + Wide + + @@ -825,38 +963,6 @@ the screw's top below the surface - - Threaded - toggled(bool) - ThreadClass - setEnabled(bool) - - - 151 - 260 - - - 338 - 265 - - - - - Threaded - toggled(bool) - ThreadFit - setDisabled(bool) - - - 151 - 260 - - - 390 - 77 - - - Threaded toggled(bool) @@ -953,38 +1059,6 @@ the screw's top below the surface - - Threaded - toggled(bool) - ThreadDepthType - setEnabled(bool) - - - 49 - 247 - - - 142 - 286 - - - - - Threaded - toggled(bool) - ThreadDepth - setEnabled(bool) - - - 58 - 249 - - - 273 - 289 - - - Threaded toggled(bool) @@ -1001,9 +1075,25 @@ the screw's top below the surface + + Threaded + toggled(bool) + ThreadFit + setDisabled(bool) + + + 151 + 260 + + + 390 + 77 + + + - + From 2b1ea8dc811ad2228f383a7a2e313d3deca2ca7d Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Mon, 13 Jan 2025 11:08:22 -0300 Subject: [PATCH 06/12] feat(PD): hole taskpanel ui hide thread model options if not applicable --- src/Mod/PartDesign/Gui/TaskHoleParameters.cpp | 65 +++++++------------ 1 file changed, 24 insertions(+), 41 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp index 59349024a4..ad9f2a1e60 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp @@ -156,23 +156,22 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole* HoleView, QWidget* pare ui->TaperedAngle->setValue(pcHole->TaperedAngle.getValue()); ui->Reversed->setChecked(pcHole->Reversed.getValue()); - ui->ModelThread->setChecked(pcHole->ModelThread.getValue()); + bool isThreaded = ui->Threaded->isChecked(); + bool isModeled = pcHole->ModelThread.getValue(); + ui->ModelThread->setChecked(isModeled); ui->UseCustomThreadClearance->setChecked(pcHole->UseCustomThreadClearance.getValue()); ui->CustomThreadClearance->setValue(pcHole->CustomThreadClearance.getValue()); ui->ThreadDepthType->setCurrentIndex(pcHole->ThreadDepthType.getValue()); ui->ThreadDepth->setValue(pcHole->ThreadDepth.getValue()); - // conditional enabling of thread modeling options ui->ModelThread->setEnabled(ui->Threaded->isChecked() && ui->ThreadType->currentIndex() != 0); - ui->UseCustomThreadClearance->setEnabled(ui->Threaded->isChecked() - && ui->ModelThread->isChecked()); - ui->CustomThreadClearance->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked() - && ui->UseCustomThreadClearance->isChecked()); + ui->CustomClearanceWidget->setVisible(isThreaded && isModeled); + ui->CustomThreadClearance->setEnabled(ui->UseCustomThreadClearance->isChecked()); ui->UpdateView->setChecked(false); - ui->UpdateView->setEnabled(ui->ModelThread->isChecked()); + ui->UpdateView->setVisible(isThreaded && isModeled); ui->Depth->setEnabled(std::string(pcHole->DepthType.getValueAsString()) == "Dimension"); - ui->ThreadDepthType->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked()); + ui->ThreadDepthWidget->setVisible(isThreaded && isModeled); ui->ThreadDepth->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked() && std::string(pcHole->ThreadDepthType.getValueAsString()) == "Dimension"); @@ -265,51 +264,35 @@ void TaskHoleParameters::threadedChanged() bool isChecked = ui->Threaded->isChecked(); pcHole->Threaded.setValue(isChecked); - ui->ModelThread->setEnabled(isChecked); - ui->ThreadDepthType->setEnabled(isChecked); - ui->ThreadDepth->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked() - && std::string(pcHole->ThreadDepthType.getValueAsString()) - == "Dimension"); - - // conditional enabling of thread modeling options - ui->UseCustomThreadClearance->setEnabled(ui->Threaded->isChecked() - && ui->ModelThread->isChecked()); - ui->CustomThreadClearance->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked() - && ui->UseCustomThreadClearance->isChecked()); - - - // update view not active if modeling threads - // this will also ensure that the feature is recomputed. - ui->UpdateView->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked()); - setUpdateBlocked(ui->Threaded->isChecked() && ui->ModelThread->isChecked() - && !(ui->UpdateView->isChecked())); - - pcHole->Threaded.setValue(ui->Threaded->isChecked()); + // run modelThreadChanged + // it will handle the visibility of the model options + modelThreadChanged(); recomputeFeature(); } void TaskHoleParameters::modelThreadChanged() { auto pcHole = getObject(); - - pcHole->ModelThread.setValue(ui->ModelThread->isChecked()); + bool isThreaded = pcHole->Threaded.getValue(); + bool isModeled = isThreaded && ui->ModelThread->isChecked(); + if (!isThreaded) { + ui->ModelThread->setChecked(false); + } + pcHole->ModelThread.setValue(isModeled); // update view not active if modeling threads // this will also ensure that the feature is recomputed. - ui->UpdateView->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked()); - setUpdateBlocked(ui->Threaded->isChecked() && ui->ModelThread->isChecked() - && !(ui->UpdateView->isChecked())); + ui->UpdateView->setVisible(isModeled); + setUpdateBlocked(isModeled && !(ui->UpdateView->isChecked())); // conditional enabling of thread modeling options - ui->UseCustomThreadClearance->setEnabled(ui->Threaded->isChecked() - && ui->ModelThread->isChecked()); - ui->CustomThreadClearance->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked() - && ui->UseCustomThreadClearance->isChecked()); + ui->CustomClearanceWidget->setVisible(isModeled); + ui->CustomThreadClearance->setEnabled(ui->UseCustomThreadClearance->isChecked()); - ui->ThreadDepthType->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked()); - ui->ThreadDepth->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked() - && std::string(pcHole->ThreadDepthType.getValueAsString()) - == "Dimension"); + ui->ThreadDepthWidget->setVisible(isThreaded && isModeled); + ui->ThreadDepth->setEnabled( + std::string(pcHole->ThreadDepthType.getValueAsString()) == "Dimension" + ); recomputeFeature(); } From 7b0296ca7cd0e05e1ef8b57038e5fc0ef57f8e66 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Mon, 13 Jan 2025 14:37:06 -0300 Subject: [PATCH 07/12] feat(PD): hole taskpanel ui hide thread group if not threaded hide threadFit if threaded --- src/Mod/PartDesign/Gui/TaskHoleParameters.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp index ad9f2a1e60..36b811f579 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp @@ -158,6 +158,8 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole* HoleView, QWidget* pare bool isThreaded = ui->Threaded->isChecked(); bool isModeled = pcHole->ModelThread.getValue(); + ui->ThreadGroupBox->setVisible(isThreaded); + ui->ClearanceWidget->setHidden(isThreaded); ui->ModelThread->setChecked(isModeled); ui->UseCustomThreadClearance->setChecked(pcHole->UseCustomThreadClearance.getValue()); ui->CustomThreadClearance->setValue(pcHole->CustomThreadClearance.getValue()); @@ -264,6 +266,8 @@ void TaskHoleParameters::threadedChanged() bool isChecked = ui->Threaded->isChecked(); pcHole->Threaded.setValue(isChecked); + ui->ThreadGroupBox->setVisible(isChecked); + ui->ClearanceWidget->setHidden(isChecked); // run modelThreadChanged // it will handle the visibility of the model options modelThreadChanged(); From 82ba235309cced57e5ea99a0294f8f8efb4242a8 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Mon, 13 Jan 2025 14:38:33 -0300 Subject: [PATCH 08/12] refactor(PD): remove the ui file connections, this are handled in the task code --- src/Mod/PartDesign/Gui/TaskHoleParameters.cpp | 1 + src/Mod/PartDesign/Gui/TaskHoleParameters.ui | 147 +----------------- 2 files changed, 2 insertions(+), 146 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp index 36b811f579..67cdbfb35d 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp @@ -549,6 +549,7 @@ void TaskHoleParameters::drillForDepthChanged() void TaskHoleParameters::taperedChanged() { + ui->TaperedAngle->setEnabled(ui->Tapered->isChecked()); if (auto hole = getObject()) { hole->Tapered.setValue(ui->Tapered->isChecked()); recomputeFeature(); diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui index 2c0f859716..e5997a7e9f 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui @@ -946,152 +946,7 @@ Only available for holes without thread - - - Tapered - toggled(bool) - TaperedAngle - setEnabled(bool) - - - 137 - 187 - - - 345 - 192 - - - - - Threaded - toggled(bool) - directionLeftHand - setEnabled(bool) - - - 85 - 249 - - - 151 - 323 - - - - - Threaded - toggled(bool) - directionRightHand - setEnabled(bool) - - - 85 - 249 - - - 336 - 323 - - - - - UseCustomThreadClearance - toggled(bool) - CustomThreadClearance - setEnabled(bool) - - - 113 - 384 - - - 259 - 382 - - - - - ModelThread - toggled(bool) - UseCustomThreadClearance - setVisible(bool) - - - 85 - 353 - - - 80 - 381 - - - - - ModelThread - toggled(bool) - CustomThreadClearance - setVisible(bool) - - - 127 - 358 - - - 274 - 396 - - - - - ModelThread - toggled(bool) - UpdateView - setVisible(bool) - - - 170 - 358 - - - 233 - 356 - - - - - Threaded - toggled(bool) - ModelThread - setEnabled(bool) - - - 27 - 252 - - - 43 - 357 - - - - - Threaded - toggled(bool) - ThreadFit - setDisabled(bool) - - - 151 - 260 - - - 390 - 77 - - - - + From e892af6bb6123ce9e3f58a199dc5c59c9be7f993 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Mon, 13 Jan 2025 14:57:00 -0300 Subject: [PATCH 09/12] feat(PD): hole taskpanel ui hide hole cut options if not cut --- src/Mod/PartDesign/Gui/TaskHoleParameters.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp index 67cdbfb35d..27593ebd13 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp @@ -119,6 +119,16 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole* HoleView, QWidget* pare ui->HoleCutType->addItem(tr(it.c_str())); } ui->HoleCutType->setCurrentIndex(pcHole->HoleCutType.getValue()); + + bool isNotCut = pcHole->HoleCutType.getValue() == 0L; + ui->labelHoleCutDiameter->setHidden(isNotCut); + ui->labelHoleCutDepth->setHidden(isNotCut); + ui->labelHoleCutCountersinkAngle->setHidden(isNotCut); + ui->HoleCutDiameter->setHidden(isNotCut); + ui->HoleCutDepth->setHidden(isNotCut); + ui->HoleCutCountersinkAngle->setHidden(isNotCut); + ui->HoleCutCustomValues->setHidden(isNotCut); + ui->HoleCutCustomValues->setChecked(pcHole->HoleCutCustomValues.getValue()); ui->HoleCutCustomValues->setDisabled(pcHole->HoleCutCustomValues.isReadOnly()); // HoleCutDiameter must not be smaller or equal than the Diameter @@ -383,6 +393,16 @@ void TaskHoleParameters::holeCutTypeChanged(int index) // we must do this after recomputeFeature() because this gives us the info if // the type is a countersink and thus if HoleCutCountersinkAngle can be enabled std::string HoleCutTypeString = hole->HoleCutType.getValueAsString(); + + bool isNotCut = HoleCutTypeString == "None"; + ui->labelHoleCutDiameter->setHidden(isNotCut); + ui->labelHoleCutDepth->setHidden(isNotCut); + ui->labelHoleCutCountersinkAngle->setHidden(isNotCut); + ui->HoleCutDiameter->setHidden(isNotCut); + ui->HoleCutDepth->setHidden(isNotCut); + ui->HoleCutCountersinkAngle->setHidden(isNotCut); + ui->HoleCutCustomValues->setHidden(isNotCut); + if (HoleCutTypeString == "None" || HoleCutTypeString == "Counterbore" || HoleCutTypeString == "Countersink" || HoleCutTypeString == "Counterdrill") { ui->HoleCutCustomValues->setEnabled(false); From 0d83940e5be9e82b2a3c5b07a1088af03bab167b Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Mon, 13 Jan 2025 16:20:51 -0300 Subject: [PATCH 10/12] feat(PD): hole taskpanel ui hide thread options if profile is none --- src/Mod/PartDesign/Gui/TaskHoleParameters.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp index 27593ebd13..1844cec248 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp @@ -73,10 +73,13 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole* HoleView, QWidget* pare // read values from the hole properties auto pcHole = getObject(); + bool isNone = std::string(pcHole->ThreadType.getValueAsString()) == "None"; + + ui->Threaded->setHidden(isNone); + ui->ThreadSize->setHidden(isNone); + ui->labelSize->setHidden(isNone); ui->Threaded->setChecked(pcHole->Threaded.getValue()); - ui->Threaded->setDisabled(std::string(pcHole->ThreadType.getValueAsString()) == "None"); - ui->ThreadType->setCurrentIndex(pcHole->ThreadType.getValue()); ui->ThreadSize->clear(); @@ -85,7 +88,6 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole* HoleView, QWidget* pare ui->ThreadSize->addItem(tr(it.c_str())); } ui->ThreadSize->setCurrentIndex(pcHole->ThreadSize.getValue()); - ui->ThreadSize->setEnabled(pcHole->ThreadType.getValue() != 0L); ui->ThreadClass->clear(); cursor = pcHole->ThreadClass.getEnumVector(); @@ -169,7 +171,7 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole* HoleView, QWidget* pare bool isThreaded = ui->Threaded->isChecked(); bool isModeled = pcHole->ModelThread.getValue(); ui->ThreadGroupBox->setVisible(isThreaded); - ui->ClearanceWidget->setHidden(isThreaded); + ui->ClearanceWidget->setHidden(isNone || isThreaded); ui->ModelThread->setChecked(isModeled); ui->UseCustomThreadClearance->setChecked(pcHole->UseCustomThreadClearance.getValue()); ui->CustomThreadClearance->setValue(pcHole->CustomThreadClearance.getValue()); @@ -622,7 +624,13 @@ void TaskHoleParameters::threadTypeChanged(int index) hole->ThreadType.setValue(index); // Threaded checkbox is meaningless if no thread profile is selected. - ui->Threaded->setDisabled(std::string(hole->ThreadType.getValueAsString()) == "None"); + bool isNone = std::string(hole->ThreadType.getValueAsString()) == "None"; + bool isThreaded = hole->Threaded.getValue(); + ui->Threaded->setHidden(isNone); + ui->ThreadGroupBox->setHidden(isNone || !isThreaded); + ui->ThreadSize->setHidden(isNone); + ui->labelSize->setHidden(isNone); + ui->ClearanceWidget->setHidden(isNone || isThreaded); // size and clearance if (TypeClass == QByteArray("ISO")) { From 539c0ca518bae02402ad27c71751d9c5bec19f9f Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Tue, 14 Jan 2025 06:04:10 -0300 Subject: [PATCH 11/12] refactor(PD): hole taskpanel alias/promote QuantitySpinBox from QDoubleSpinBox instead of QWidget to represent it correctly on the designer --- src/Mod/PartDesign/Gui/TaskHoleParameters.ui | 92 ++++++++++---------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui index e5997a7e9f..0f74c12eed 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui @@ -23,7 +23,7 @@ - + 0 @@ -42,15 +42,15 @@ under 90: smaller hole radius at the bottom over 90: larger hole radius at the bottom - + false + + 0.000000000000000 + deg - - 0.000000000000000 - @@ -71,7 +71,7 @@ over 90: larger hole radius at the bottom - + 0 @@ -87,15 +87,15 @@ over 90: larger hole radius at the bottom Hole diameter - + false + + 0.000000000000000 + mm - - 0.000000000000000 - @@ -169,7 +169,7 @@ over 90: larger hole radius at the bottom - + 0 @@ -182,7 +182,7 @@ over 90: larger hole radius at the bottom 20 - + false @@ -277,7 +277,7 @@ over 90: larger hole radius at the bottom - + 0 @@ -293,18 +293,18 @@ over 90: larger hole radius at the bottom Qt::NoContextMenu - + false + + 0.000000000000000 + + + 0.100000000000000 + mm - - 0.000000000000000 - - - 0.100000000000000 - @@ -321,7 +321,7 @@ over 90: larger hole radius at the bottom - + 0 @@ -338,18 +338,18 @@ over 90: larger hole radius at the bottom For countersinks this is the depth of the screw's top below the surface - + false + + 0.000000000000000 + + + 0.100000000000000 + mm - - 0.000000000000000 - - - 0.100000000000000 - @@ -366,7 +366,7 @@ the screw's top below the surface - + 0 @@ -379,15 +379,15 @@ the screw's top below the surface 20 - + false + + 0.000000000000000 + deg - - 0.000000000000000 - @@ -463,7 +463,7 @@ the screw's top below the surface - + 0 @@ -476,15 +476,15 @@ the screw's top below the surface 20 - + false + + 0.000000000000000 + deg - - 0.000000000000000 - @@ -744,7 +744,7 @@ Note that the calculation can take some time - + 0 @@ -757,7 +757,7 @@ Note that the calculation can take some time 20 - + false @@ -805,7 +805,7 @@ Note that the calculation can take some time - + 0 @@ -821,15 +821,15 @@ Note that the calculation can take some time Custom Thread clearance value - + false + + 0.100000000000000 + mm - - 0.100000000000000 - @@ -936,7 +936,7 @@ Only available for holes without thread Gui::QuantitySpinBox - QWidget + QDoubleSpinBox
Gui/QuantitySpinBox.h
From a23e89864599abb2743acbfc58f84295545047d0 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Wed, 15 Jan 2025 14:57:49 -0300 Subject: [PATCH 12/12] refactor(PD): hole taskpanel remove minimumSize --- src/Mod/PartDesign/Gui/TaskHoleParameters.ui | 54 -------------------- 1 file changed, 54 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui index 0f74c12eed..c0667192c0 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.ui @@ -30,12 +30,6 @@ 0 - - - 0 - 20 - - Taper angle for the hole 90 degree: straight hole @@ -78,12 +72,6 @@ over 90: larger hole radius at the bottom 0 - - - 0 - 20 - - Hole diameter @@ -176,12 +164,6 @@ over 90: larger hole radius at the bottom 0 - - - 0 - 20 - - false @@ -284,12 +266,6 @@ over 90: larger hole radius at the bottom 0 - - - 0 - 20 - - Qt::NoContextMenu @@ -328,12 +304,6 @@ over 90: larger hole radius at the bottom 0 - - - 0 - 20 - - For countersinks this is the depth of the screw's top below the surface @@ -373,12 +343,6 @@ the screw's top below the surface 0 - - - 0 - 20 - - false @@ -470,12 +434,6 @@ the screw's top below the surface 0 - - - 0 - 20 - - false @@ -751,12 +709,6 @@ Note that the calculation can take some time 0 - - - 0 - 20 - - false @@ -812,12 +764,6 @@ Note that the calculation can take some time 0 - - - 0 - 20 - - Custom Thread clearance value