Salome HOME
Improve multi-selector control to provide items multi-selection and "Delete" context...
[modules/shaper.git] / src / ModuleBase / ModuleBase_ModelWidget.cpp
index fc7beb3e2760b206dd786e1b333459758bdb28de..86fe765daafc4e328d73f14677ec27471f799be4 100644 (file)
@@ -31,6 +31,8 @@ ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent,
       myState(Stored),
       myIsValueStateBlocked(false)
 {
+  myIsInternal = theData->getBooleanAttribute(ATTR_INTERNAL, false);
+
   myDefaultValue = theData->getProperty(ATTR_DEFAULT);
   myUseReset = theData->getBooleanAttribute(ATTR_USE_RESET, true);
   myIsComputedDefault = theData->getProperty(ATTR_DEFAULT) == DOUBLE_WDG_DEFAULT_COMPUTED;
@@ -171,7 +173,7 @@ void ModuleBase_ModelWidget::activate()
 void ModuleBase_ModelWidget::deactivate()
 {
   myIsValueStateBlocked = false;
-  if (myState == ModifiedInPP)
+  if (myState == ModifiedInPP || myState == ModifiedInViewer)
     storeValue();
   myState = Stored;
 }
@@ -298,8 +300,11 @@ bool ModuleBase_ModelWidget::eventFilter(QObject* theObject, QEvent *theEvent)
                         aReason == Qt::TabFocusReason ||
                         aReason == Qt::BacktabFocusReason ||
                         aReason == Qt::OtherFocusReason; // to process widget->setFocus()
-    if (aMouseOrKey && getControls().contains(aWidget) && getValueState() == ModifiedInPP)
-      storeValue();
+    if (aMouseOrKey && getControls().contains(aWidget)) {
+      if (getValueState() == ModifiedInPP) {
+        storeValue();
+      }
+    }
   }
   // pass the event on to the parent class