Salome HOME
bos #19890: Fix wrong initialized type of symmetry operation in property panel
authorvsv <vsv@opencascade.com>
Mon, 10 Aug 2020 14:06:38 +0000 (17:06 +0300)
committervsv <vsv@opencascade.com>
Mon, 10 Aug 2020 14:06:38 +0000 (17:06 +0300)
src/ModuleBase/ModuleBase_PagedContainer.cpp
src/ModuleBase/ModuleBase_PagedContainer.h

index f821c793f7df970e045e174f3a8e82418a8a6dc2..d96a7c70a8cdf6693424e4f96ebfdc552c2fd59e 100644 (file)
@@ -34,7 +34,7 @@ static QMap<std::string, std::string> defaultValues;
 ModuleBase_PagedContainer::ModuleBase_PagedContainer(QWidget* theParent,
                                                      const Config_WidgetAPI* theData)
 : ModuleBase_ModelWidget(theParent, theData),
-  myRemeberChoice(true), myIsFocusOnCurrentPage(false), myIsFirst(true)
+  myRemeberChoice(true), myIsFocusOnCurrentPage(false)
 {
   // it is not obligatory to be ignored when property panel tries to activate next active widget
   // but if focus is moved to this control, it can accept it.
@@ -107,7 +107,7 @@ bool ModuleBase_PagedContainer::restoreValueCustom()
       aCaseId = QString::fromStdString(aStringAttr->value());
     else
       aCaseId = QString::fromStdString(aDefVal.empty() ? aStringAttr->value() : aDefVal);
-    if (myIsFirst)
+    if (!aStringAttr->isInitialized())
       storeValueCustom();
     int idx = myCaseIds.indexOf(aCaseId);
     if (idx == -1)
@@ -140,7 +140,7 @@ bool ModuleBase_PagedContainer::storeValueCustom()
 
   AttributeStringPtr aStringAttr = aData->string(attributeID());
   std::string aWidgetValue;
-  if (myIsFirst)
+  if (!aStringAttr->isInitialized())
     aWidgetValue = myDefValue.empty()?
         myCaseIds.at(currentPageIndex()).toStdString() : myDefValue;
   else
@@ -148,8 +148,6 @@ bool ModuleBase_PagedContainer::storeValueCustom()
   myDefValue = aWidgetValue;
   aStringAttr->setValue(aWidgetValue);
 
-  myIsFirst = false;
-
   updateObject(myFeature); // for preview
   return true;
 }
index 9e60263dee121783f8ef491d44c1b4a722f6e331..0227e4b2ff9d22f3966595e0f7cb8fb5b1316a58 100644 (file)
@@ -92,7 +92,6 @@ class MODULEBASE_EXPORT ModuleBase_PagedContainer : public ModuleBase_ModelWidge
   bool myIsFocusOnCurrentPage;
   QStringList myCaseIds;
   QList<ModuleBase_PageBase*> myPages;
-  bool myIsFirst;
   std::string myDefValue;
 };