Salome HOME
Updated copyright comment
[modules/shaper.git] / src / ModuleBase / ModuleBase_ModelWidget.cpp
index f26b8a600f8d0a4b1008b03195dcf448a9271cc1..d70c6572a49203eff321c0f98dcabd31f91d7c89 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 
 //**************************************************************
 ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent,
-                                               const Config_WidgetAPI* theData)
-    : QWidget(theParent),
-      myIsEditing(false),
-      myState(Stored),
-      myIsValueStateBlocked(false),
-      myFlushUpdateBlocked(false),
-      myWidgetValidator(0)
+  const Config_WidgetAPI* theData)
+  : QWidget(theParent),
+  myWidgetValidator(0),
+  myState(Stored),
+  myIsEditing(false),
+  myIsValueStateBlocked(false),
+  myFlushUpdateBlocked(false)
 {
 #ifdef DEBUG_WIDGET_INSTANCE
   qDebug("ModuleBase_ModelWidget::ModuleBase_ModelWidget");
@@ -65,9 +65,12 @@ ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent,
   myFeatureId = theData->featureId();
 
   myIsInternal = theData->getBooleanAttribute(ATTR_INTERNAL, false);
+  myUseExternalParts = theData->getBooleanAttribute("allow_parts_content", false);
 
   myIsModifiedInEdit = theData->getProperty(ATTR_MODIFIED_IN_EDIT);
 
+  myUpdateVisualAttributes = theData->getBooleanAttribute(ATTR_VISUAL_CHANGED, false);
+
   myDefaultValue = theData->getProperty(ATTR_DEFAULT);
   myUseReset = theData->getBooleanAttribute(ATTR_USE_RESET, true);
   myIsComputedDefault = theData->getProperty(ATTR_DEFAULT) == DOUBLE_WDG_DEFAULT_COMPUTED;
@@ -188,7 +191,6 @@ QString ModuleBase_ModelWidget::getError(const bool theValueStateChecked) const
   if (!feature().get())
     return anError;
 
-  std::string aFeatureID = feature()->getKind();
   std::string anAttributeID = attributeID();
   AttributePtr anAttribute = feature()->attribute(anAttributeID);
   if (!anAttribute.get())
@@ -203,7 +205,7 @@ QString ModuleBase_ModelWidget::getError(const bool theValueStateChecked) const
       anErrorMsg = "Unknown error.";
 
     if (anErrorMsg.context().empty()) {
-      anErrorMsg.setContext(aFeatureID + ":" + anAttributeID + ":" + aValidatorID);
+      anErrorMsg.setContext(context() + ":" + aValidatorID);
     }
   }
 
@@ -443,6 +445,10 @@ void ModuleBase_ModelWidget::updateObject(ObjectPtr theObject)
 #ifdef DEBUG_WIDGET_INSTANCE
     qDebug("ModuleBase_ModelWidget::updateObject");
 #endif
+    if (myFeature.get() && myUpdateVisualAttributes) {
+      static const Events_ID anEvent = Events_Loop::eventByName(EVENT_VISUAL_ATTRIBUTES);
+      ModelAPI_EventCreator::get()->sendUpdated(myFeature, anEvent);
+    }
     ModuleBase_Tools::flushUpdated(theObject);
     emit objectUpdated();
   }