Reset for the widget value by mouse leaving the active window.
: QObject(theParent),
myParentId(theParentId)
{
- myIsValueDefault = !theData->getProperty(ATTR_DEFAULT).empty();
+ myDefaultValue = theData->getProperty(ATTR_DEFAULT);
myIsComputedDefault = false;
myAttributeID = theData ? theData->widgetId() : "";
{
}
+ /// Fills the widget with default values
+ virtual void reset() {};
+
/// Returns the state whether the attribute of the feature is initialized
/// \param theObject a model feature to be checked
/// \return the boolean result
/// Returns true, if default value of the widget is defined in the XML and it is not the
/// computed value
/// \return the boolean result
- bool isValueDefault() { return myIsValueDefault; }
+ bool isValueDefault() { return !myDefaultValue.empty(); }
/// Defines if it is supposed that the widget should interact with the viewer.
virtual bool isViewerSelector() { return false; }
/// Value should be computed on execute, like radius for circle's constraint (can not be zero)
bool myIsComputedDefault;
- /// the default value is defined in the XML for this attribute
- bool myIsValueDefault;
+ /// the default value, which is defined in the XML for this attribute
+ std::string myDefaultValue;
+
/// Flag which shows that current operation is in editing mode
bool myIsEditing;
};
mySpinBox->setSingleStep(aStepVal);
}
- aProp = theData->getProperty(ATTR_DEFAULT);
- double aDefVal = QString::fromStdString(aProp).toDouble(&isOk);
+ double aDefVal = QString::fromStdString(myDefaultValue).toDouble(&isOk);
if (isOk) {
mySpinBox->setValue(aDefVal);
} else if (aProp == DOUBLE_WDG_DEFAULT_COMPUTED){
{
}
+void ModuleBase_WidgetDoubleValue::reset()
+{
+ bool isOk;
+ double aDefValue = QString::fromStdString(myDefaultValue).toDouble(&isOk);
+ mySpinBox->setValue(isOk ? aDefValue : 0.0);
+}
+
bool ModuleBase_WidgetDoubleValue::storeValue() const
{
DataPtr aData = myFeature->data();
virtual ~ModuleBase_WidgetDoubleValue();
+ /// Fills the widget with default values
+ virtual void reset();
+
//! Read value of corresponded attribute from data model to the input control
// \return True in success
virtual bool restoreValue();
void PartSet_SketcherMgr::onMouseMoveOverWindow(bool theOverWindow)
{
+ ModuleBase_Operation* aOperation = myModule->workshop()->currentOperation();
+ if (!aOperation || aOperation->isEditOperation())
+ return;
+
myIsMouseOverWindow = theOverWindow;
if (theOverWindow)
myIsPropertyPanelValueChanged = false;
-
+ else {
+ ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
+ ModuleBase_ModelWidget* aActiveWgt = aPanel->activeWidget();
+ if(aActiveWgt) {
+ aActiveWgt->reset();
+ }
+ }
updateVisibilityOfCreatedFeature();
}
void PartSet_SketcherMgr::onValuesChangedInPropertyPanel()
{
+ ModuleBase_Operation* aOperation = myModule->workshop()->currentOperation();
+ if (!aOperation || aOperation->isEditOperation())
+ return;
+
myIsPropertyPanelValueChanged = true;
updateVisibilityOfCreatedFeature();
}
}
+void PartSet_WidgetPoint2D::reset()
+{
+ bool isOk;
+ double aDefValue = QString::fromStdString(myDefaultValue).toDouble(&isOk);
+
+ myXSpin->setValue(isOk ? aDefValue : 0.0);
+ myYSpin->setValue(isOk ? aDefValue : 0.0);
+}
+
PartSet_WidgetPoint2D::~PartSet_WidgetPoint2D()
{
}
/// Destructor
virtual ~PartSet_WidgetPoint2D();
+ /// Fills the widget with default values
+ virtual void reset();
+
/// Set the given wrapped value to the current widget
/// This value should be processed in the widget according to the needs
/// \param theValue the wrapped widget value
{
}
+void PartSet_WidgetPoint2dDistance::reset()
+{
+ bool isOk;
+ double aDefValue = QString::fromStdString(myDefaultValue).toDouble(&isOk);
+ mySpinBox->setValue(isOk ? aDefValue : 0.0);
+}
+
void PartSet_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature,
const std::shared_ptr<GeomAPI_Pnt2d>& thePnt)
{
virtual ~PartSet_WidgetPoint2dDistance();
+ /// Fills the widget with default values
+ virtual void reset();
+
/// The methiod called when widget is deactivated
virtual void deactivate();