From 9c710f79194400664d41e147a7c783b86c906d53 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 29 Jun 2015 15:34:21 +0300 Subject: [PATCH] Issue #604 Creation of an unexpected line in the Sketcher Regression: Apply is always disable during mirror operation when the cursor is over property panel. Using myIsResetCurrentValue instead of myIsPropertyPanelValueChanged. --- src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp | 14 ++++++-------- src/ModuleBase/ModuleBase_WidgetIntValue.cpp | 14 ++++++-------- src/ModuleBase/ModuleBase_WidgetIntValue.h | 2 +- src/PartSet/PartSet_WidgetPoint2d.cpp | 14 ++++++-------- src/PartSet/PartSet_WidgetPoint2d.h | 2 +- 5 files changed, 20 insertions(+), 26 deletions(-) diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index d0e7a9c20..230f49220 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -92,15 +92,11 @@ ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue() { } -void ModuleBase_WidgetDoubleValue::reset() +bool ModuleBase_WidgetDoubleValue::reset() { - if (!isUseReset()) - return; - - if (isComputedDefault() || mySpinBox->hasVariable()) { - return; - //if (myFeature->compute(myAttributeID)) - // restoreValue(); + bool aDone = false; + if (!isUseReset() || isComputedDefault() || mySpinBox->hasVariable()) { + aDone = false; } else { bool isOk; double aDefValue = QString::fromStdString(getDefaultValue()).toDouble(&isOk); @@ -109,8 +105,10 @@ void ModuleBase_WidgetDoubleValue::reset() if (isOk) { ModuleBase_Tools::setSpinValue(mySpinBox, aDefValue); storeValueCustom(); + aDone = true; } } + return aDone; } bool ModuleBase_WidgetDoubleValue::storeValueCustom() const diff --git a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp index f09f9c056..a0daa7124 100644 --- a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp @@ -91,15 +91,11 @@ ModuleBase_WidgetIntValue::~ModuleBase_WidgetIntValue() { } -void ModuleBase_WidgetIntValue::reset() +bool ModuleBase_WidgetIntValue::reset() { - if (!isUseReset()) - return; - - if (isComputedDefault()) { - return; - //if (myFeature->compute(myAttributeID)) - // restoreValue(); + bool aDone = false; + if (!isUseReset() || isComputedDefault()) { + aDone = false; } else { bool isOk; int aDefValue = QString::fromStdString(getDefaultValue()).toInt(&isOk); @@ -110,8 +106,10 @@ void ModuleBase_WidgetIntValue::reset() mySpinBox->setValue(isOk ? aDefValue : 0); mySpinBox->blockSignals(isBlocked); storeValueCustom(); + aDone = true; } } + return aDone; } bool ModuleBase_WidgetIntValue::storeValueCustom() const diff --git a/src/ModuleBase/ModuleBase_WidgetIntValue.h b/src/ModuleBase/ModuleBase_WidgetIntValue.h index b795bc1c8..aa7958b9b 100644 --- a/src/ModuleBase/ModuleBase_WidgetIntValue.h +++ b/src/ModuleBase/ModuleBase_WidgetIntValue.h @@ -38,7 +38,7 @@ Q_OBJECT virtual ~ModuleBase_WidgetIntValue(); /// Fills the widget with default values - virtual void reset(); + virtual bool reset(); //! Read value of corresponded attribute from data model to the input control // \return True in success diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index 6ad84d8fe..5b5659a1c 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -99,15 +99,11 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, setLayout(aLayout); } -void PartSet_WidgetPoint2D::reset() +bool PartSet_WidgetPoint2D::reset() { - if (!isUseReset()) - return; - - if (isComputedDefault() || myXSpin->hasVariable() || myYSpin->hasVariable()) { - return; - //if (myFeature->compute(myAttributeID)) - // restoreValue(); + bool aDone = false; + if (!isUseReset() || isComputedDefault() || myXSpin->hasVariable() || myYSpin->hasVariable()) { + aDone = false; } else { bool isOk; @@ -117,7 +113,9 @@ void PartSet_WidgetPoint2D::reset() ModuleBase_Tools::setSpinValue(myXSpin, isOk ? aDefValue : 0.0); ModuleBase_Tools::setSpinValue(myYSpin, isOk ? aDefValue : 0.0); storeValueCustom(); + aDone = true; } + return aDone; } PartSet_WidgetPoint2D::~PartSet_WidgetPoint2D() diff --git a/src/PartSet/PartSet_WidgetPoint2d.h b/src/PartSet/PartSet_WidgetPoint2d.h index 473eccfed..77ead09c2 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.h +++ b/src/PartSet/PartSet_WidgetPoint2d.h @@ -51,7 +51,7 @@ Q_OBJECT virtual ~PartSet_WidgetPoint2D(); /// Fills the widget with default values - virtual void reset(); + virtual bool reset(); /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs -- 2.39.2