]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #937: Process update of objects in Object Browser
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 10 Sep 2015 14:40:59 +0000 (17:40 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 10 Sep 2015 14:40:59 +0000 (17:40 +0300)
src/XGUI/XGUI_DataModel.cpp

index a8fa72080920d15d8b8880a517588d140a83e90e..c6ccd9e92f96257856fbf9f11c652cf4c2a94f0a 100644 (file)
@@ -65,6 +65,7 @@ XGUI_DataModel::XGUI_DataModel(QObject* theParent) : ModuleBase_IDocumentDataMod
   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_OBJECT_UPDATED));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_ORDER_UPDATED));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED));
 }
@@ -207,6 +208,19 @@ void XGUI_DataModel::processEvent(const std::shared_ptr<Events_Message>& theMess
 #endif
       }
     }
+  } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) {
+    std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
+        std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+    std::set<ObjectPtr> aObjects = aUpdMsg->objects();
+
+    std::set<ObjectPtr>::const_iterator aIt;
+    std::string aObjType;
+    for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
+      ObjectPtr aObject = (*aIt);
+      QModelIndex aIndex = objectIndex(aObject);
+      if (aIndex.isValid())
+        emit dataChanged(aIndex, aIndex);
+    }
   } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_ORDER_UPDATED)) {
     std::shared_ptr<ModelAPI_OrderUpdatedMessage> aUpdMsg =
         std::dynamic_pointer_cast<ModelAPI_OrderUpdatedMessage>(theMessage);