Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / XGUI / XGUI_DocumentDataModel.cpp
index c5b0cbd9b78454fbfddba3bf2e6fd96b65a218e4..2c4470cce95b8d88c0fb3c7dc4d5758499bbbd33 100644 (file)
@@ -431,7 +431,15 @@ bool XGUI_DocumentDataModel::activatedIndex(const QModelIndex& theIndex)
     // if this is root node (Part item index)
     if (!aIndex->parent().isValid()) {
       if (myActivePart) myActivePart->setItemsColor(PASSIVE_COLOR);
-      myActivePart = (myActivePart == aModel)? 0 : (XGUI_PartModel*)aModel;
+
+      if (myActivePart == aModel) {
+        myActivePart = 0;
+        myActivePartIndex = QModelIndex();
+      } else {
+        myActivePart = (XGUI_PartModel*)aModel;
+        myActivePartIndex = theIndex;
+      }
+
       if (myActivePart) {
         myActivePart->setItemsColor(ACTIVE_COLOR);
         myModel->setItemsColor(PASSIVE_COLOR);
@@ -448,4 +456,12 @@ FeaturePtr XGUI_DocumentDataModel::activePart() const
   if (myActivePart) 
     return myActivePart->part();
   return FeaturePtr();
-}
\ No newline at end of file
+}
+
+void XGUI_DocumentDataModel::deactivatePart() 
+{ 
+  if (myActivePart) 
+    myActivePart->setItemsColor(PASSIVE_COLOR);
+  myActivePart = 0;
+  myModel->setItemsColor(ACTIVE_COLOR);
+}