]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Update Part item on activation of loaded document
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 20 Aug 2015 13:30:43 +0000 (16:30 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 20 Aug 2015 13:30:58 +0000 (16:30 +0300)
src/PartSet/PartSet_Module.cpp
src/SketcherPrs/SketcherPrs_Angle.h [new file with mode: 0644]
src/XGUI/XGUI_DataModel.cpp

index 03b29dd75a50a4cc255b261bb270f8bd7b171b29..3f14bed770aa4cda632ee2ff46128b20d15ecab8 100755 (executable)
@@ -908,8 +908,6 @@ void PartSet_Module::processEvent(const std::shared_ptr<Events_Message>& theMess
       }
     }
 #else
-    // Problem with MPV: At first time on creation it doesn't work because Part feature
-    // creation event will be sent after
     if (aActivePartIndex.isValid())
       aTreeView->setExpanded(aActivePartIndex, false);
     XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel();
diff --git a/src/SketcherPrs/SketcherPrs_Angle.h b/src/SketcherPrs/SketcherPrs_Angle.h
new file mode 100644 (file)
index 0000000..365e82b
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        SketcherPrs_Angle.h
+// Created:     26 March 2015
+// Author:      Vitaly SMETANNIKOV
+
+
+#ifndef SketcherPrs_Angle_H
+#define SketcherPrs_Angle_H
+
+
+
+#endif
\ No newline at end of file
index 40e5c81367806e2809527588028dc14e13a4dfcd..0b2724532b819f02bdab27c6aff5ba1af3961b80 100644 (file)
@@ -61,6 +61,7 @@ XGUI_DataModel::XGUI_DataModel(QObject* theParent) : QAbstractItemModel(theParen
   Events_Loop* aLoop = Events_Loop::loop();
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED));
+  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED));
 }
 
 //******************************************************
@@ -128,9 +129,8 @@ void XGUI_DataModel::processEvent(const std::shared_ptr<Events_Message>& theMess
           }
         } 
 #ifdef _DEBUG
-        else {
+        else
           Events_Error::send("Problem with Data Model definition of sub-document");
-        }
 #endif
       }
     }
@@ -186,12 +186,22 @@ void XGUI_DataModel::processEvent(const std::shared_ptr<Events_Message>& theMess
           }
         } 
 #ifdef _DEBUG
-        else {
+        else
           Events_Error::send("Problem with Data Model definition of sub-document");
-        }
 #endif
       }
     }
+  } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOCUMENT_CHANGED)) {
+    DocumentPtr aDoc = ModelAPI_Session::get()->activeDocument();
+    if (aDoc != aRootDoc) {
+      QModelIndex aDocRoot = findDocumentRootIndex(aDoc.get());
+      if (aDocRoot.isValid())
+        emit dataChanged(aDocRoot, aDocRoot);
+#ifdef _DEBUG
+      else
+        Events_Error::send("Problem with Data Model definition of sub-document");
+#endif
+    }
   } 
 }
 
@@ -584,7 +594,7 @@ bool XGUI_DataModel::hasChildren(const QModelIndex& theParent) const
       // Check for Part feature
       ResultPartPtr aPartRes = getPartResult(aObj);
       if (aPartRes.get())
-        return true;
+        return aPartRes->partDoc().get() != NULL;
       else {
         // Check for composite object
         ModelAPI_CompositeFeature* aCompFeature = dynamic_cast<ModelAPI_CompositeFeature*>(aObj);