Do not store value if the default value was not defined in the XML file.
It corrects setValue in the Point2D to update attributes even if the value are the same.
void GeomData_Point2D::setValue(const double theX, const double theY)
{
- if (myCoords->Value(0) != theX || myCoords->Value(1) != theY) {
+ if (!myIsInitialized || myCoords->Value(0) != theX || myCoords->Value(1) != theY) {
myCoords->SetValue(0, theX);
myCoords->SetValue(1, theY);
owner()->data()->sendAttributeUpdated(this);
: QObject(theParent),
myParentId(theParentId)
{
+ myIsValueDefault = !theData->getProperty(ATTR_DEFAULT).empty();
myIsComputedDefault = false;
myAttributeID = theData ? theData->widgetId() : "";
}
/// on operation's execute, like radius for circle's constraint (can not be zero)
bool isComputedDefault() { return myIsComputedDefault; }
+ /// 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; }
+
/// Defines if it is supposed that the widget should interact with the viewer.
virtual bool isViewerSelector() { return false; }
bool myIsComputedDefault; /// Value should be computed on execute,
/// like radius for circle's constraint (can not be zero)
+ bool myIsValueDefault; /// the default value is defined in the XML for this attribute
bool myIsEditing;
};
QIntList aModes;
aModes << TopAbs_VERTEX;
myWorkshop->moduleConnector()->activateSubShapesSelection(aModes);
+ // the control value is stored to the mode by the focus in on the widget
+ // we need the value is initialized in order to enable the apply button in the property panel
+ storeValue();
}
void PartSet_WidgetPoint2D::deactivate()
if (isEditingMode())
return;
myWorkshop->operationMgr()->setLockValidating(true);
+ // the Ok button should be disabled in the property panel by moving the mouse point in the viewer
+ // this leads that the user does not try to click Ok and it avoids an incorrect situation that the
+ // line is moved to the cursor to the Ok button
myWorkshop->propertyPanel()->setOkEnabled(false);
gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWnd->v3dView());
aWidget->enableFocusProcessing();
QObject::connect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onWidgetValuesChanged()));
// Init default values
- if (!theOperation->isEditOperation() && !aWidget->isComputedDefault()) {
+ if (!theOperation->isEditOperation() && aWidget->isValueDefault() && !aWidget->isComputedDefault()) {
aWidget->storeValue();
}
}