Fix duplicate calculation at Task validation

This commit is contained in:
Florian Foinant-Willig
2024-10-02 22:43:07 +02:00
committed by Yorik van Havre
parent 866a274268
commit 151be5af1a
2 changed files with 13 additions and 7 deletions

View File

@@ -90,7 +90,7 @@ TaskDlgFeatureParameters::~TaskDlgFeatureParameters() = default;
bool TaskDlgFeatureParameters::accept()
{
App::DocumentObject* feature = getObject();
bool isUpdateBlocked = false;
try {
// Iterate over parameter dialogs and apply all parameters from them
for ( QWidget *wgt : Content ) {
@@ -100,6 +100,7 @@ bool TaskDlgFeatureParameters::accept()
param->saveHistory ();
param->apply ();
isUpdateBlocked |= param->isUpdateBlocked();
}
// Make sure the feature is what we are expecting
// Should be fine but you never know...
@@ -107,7 +108,12 @@ bool TaskDlgFeatureParameters::accept()
throw Base::TypeError("Bad object processed in the feature dialog.");
}
Gui::cmdAppDocument(feature, "recompute()");
if(isUpdateBlocked){
Gui::cmdAppDocument(feature, "recompute()");
} else {
// object was already computed
Gui::cmdAppDocument(feature, "purgeTouched()");
}
if (!feature->isValid()) {
throw Base::RuntimeError(getObject()->getStatusString());

View File

@@ -51,6 +51,11 @@ public:
void recomputeFeature();
bool isUpdateBlocked() const
{
return blockUpdate;
}
protected Q_SLOTS:
// TODO Add update view to all dialogs (2015-12-05, Fat-Zer)
void onUpdateView(bool on);
@@ -88,11 +93,6 @@ protected:
return obj ? obj->getDocument() : nullptr;
}
bool isUpdateBlocked() const
{
return blockUpdate;
}
bool& getUpdateBlockRef()
{
return blockUpdate;