From c7c420ca1d2f7779d2cd75f3fd98162c62f235b8 Mon Sep 17 00:00:00 2001 From: David Osterberg Date: Sat, 27 Feb 2021 10:43:40 +0100 Subject: [PATCH] PartDesign: Hole. Address Donovaly bugs 7 and 8 bug 7: the update view checkbox should be enabled/disabled based on Model thread. the checked state should not change bug 8: the Thread depth options should be disabled when Model thread is unchecked. because they don't do anything in the model it is confusing if they are enabled. --- src/Mod/PartDesign/Gui/TaskHoleParameters.cpp | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp index aa0e53481e..1d3a5f4166 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp @@ -177,11 +177,11 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole *HoleView, QWidget *pare ui->UseCustomThreadClearance->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked()); ui->labelThreadClearance->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked() && ui->UseCustomThreadClearance->isChecked()); ui->CustomThreadClearance->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked() && ui->UseCustomThreadClearance->isChecked()); - ui->UpdateView->setChecked(!ui->ModelThread->isChecked()); + ui->UpdateView->setChecked(false); ui->UpdateView->setEnabled(ui->ModelThread->isChecked()); - ui->ThreadDepthType->setEnabled(ui->Threaded->isChecked()); - ui->ThreadDepth->setEnabled(ui->Threaded->isChecked() && std::string(pcHole->ThreadDepthType.getValueAsString()) == "Dimension"); + ui->ThreadDepthType->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked()); + ui->ThreadDepth->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked() && std::string(pcHole->ThreadDepthType.getValueAsString()) == "Dimension"); connect(ui->Threaded, SIGNAL(clicked(bool)), this, SLOT(threadedChanged())); connect(ui->ThreadType, SIGNAL(currentIndexChanged(int)), this, SLOT(threadTypeChanged(int))); @@ -248,9 +248,11 @@ void TaskHoleParameters::threadedChanged() ui->UseCustomThreadClearance->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked()); ui->CustomThreadClearance->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked() && ui->UseCustomThreadClearance->isChecked()); - updateViewChanged(!(isChecked && ui->ModelThread->isChecked())); - ui->UpdateView->setChecked(!(isChecked && ui->ModelThread->isChecked())); - ui->UpdateView->setEnabled(isChecked && ui->ModelThread->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()); + blockUpdate = ui->Threaded->isChecked() && ui->ModelThread->isChecked() && !(ui->UpdateView->isChecked()); pcHole->Threaded.setValue(ui->Threaded->isChecked()); recomputeFeature(); @@ -259,20 +261,21 @@ void TaskHoleParameters::threadedChanged() void TaskHoleParameters::modelThreadChanged() { PartDesign::Hole* pcHole = static_cast(vp->getObject()); - bool isChecked = ui->ModelThread->isChecked(); - pcHole->ModelThread.setValue(isChecked); + pcHole->ModelThread.setValue(ui->ModelThread->isChecked()); // update view not active if modeling threads // this will also ensure that the feature is recomputed. - blockUpdate = isChecked; - ui->UpdateView->setChecked(!isChecked); - ui->UpdateView->setEnabled(isChecked); + ui->UpdateView->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked()); + blockUpdate = ui->Threaded->isChecked() && ui->ModelThread->isChecked() && !(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->ThreadDepthType->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked()); + ui->ThreadDepth->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked() && std::string(pcHole->ThreadDepthType.getValueAsString()) == "Dimension"); + recomputeFeature(); }