]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Provide names of sub-objects from Naming for Groups
authorvsv <vitaly.smetannikov@opencascade.com>
Fri, 26 Dec 2014 14:18:07 +0000 (17:18 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Fri, 26 Dec 2014 14:18:07 +0000 (17:18 +0300)
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.h

index 5c50ce38e318088dcc86d4182a45c35fae5901de..2113803386cf3b49289e117e35dbf50946d2d1b5 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Object.h>
-#include <ModelAPI_AttributeSelectionList.h>
 
 #include <Config_WidgetAPI.h>
 
@@ -93,6 +92,7 @@ bool ModuleBase_WidgetMultiSelector::storeValue() const
     foreach (GeomSelection aSelec, mySelection) {
       aSelectionListAttr->append(aSelec.first, aSelec.second);
     }
+    //updateSelectionList(aSelectionListAttr);
     updateObject(myFeature);
     return true;
   }
@@ -119,7 +119,7 @@ bool ModuleBase_WidgetMultiSelector::restoreValue()
       AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(i);
       mySelection.append(GeomSelection(aSelectAttr->context(), aSelectAttr->value()));
     }
-    updateSelectionList();
+    updateSelectionList(aSelectionListAttr);
     return true;
   }
   return false;
@@ -204,7 +204,7 @@ void ModuleBase_WidgetMultiSelector::onSelectionChanged()
     aShape->setImpl(new TopoDS_Shape(aShpIt.Value()));
     mySelection.append(GeomSelection(aResult, aShape));
   }
-  updateSelectionList();
+  //updateSelectionList();
   emit valuesChanged();
 }
 
@@ -253,25 +253,30 @@ void ModuleBase_WidgetMultiSelector::activateShapeSelection()
 }
 
 //********************************************************************
-void ModuleBase_WidgetMultiSelector::updateSelectionList()
+void ModuleBase_WidgetMultiSelector::updateSelectionList(AttributeSelectionListPtr theList)
 {
-  QString aType;
-  if (myTypeCombo->currentText().toLower() == "vertices")
-    aType = "vertex";
-  else if (myTypeCombo->currentText().toLower() == "edges")
-    aType = "edge";
-  else if (myTypeCombo->currentText().toLower() == "faces")
-    aType = "face";
-  else if (myTypeCombo->currentText().toLower() == "solids")
-    aType = "solid";
   myListControl->clear();
-  int i = 1;
-  foreach (GeomSelection aSel, mySelection) {
-    QString aName(aSel.first->data()->name().c_str());
-    aName += ":" + aType + QString("_%1").arg(i);
-    myListControl->addItem(aName);
-    i++;
+  for (int i = 0; i < theList->size(); i++) {
+    AttributeSelectionPtr aAttr = theList->value(i);
+    myListControl->addItem(aAttr->namingName().c_str());
   }
-  myListControl->repaint();
+  //QString aType;
+  //if (myTypeCombo->currentText().toLower() == "vertices")
+  //  aType = "vertex";
+  //else if (myTypeCombo->currentText().toLower() == "edges")
+  //  aType = "edge";
+  //else if (myTypeCombo->currentText().toLower() == "faces")
+  //  aType = "face";
+  //else if (myTypeCombo->currentText().toLower() == "solids")
+  //  aType = "solid";
+  //myListControl->clear();
+  //int i = 1;
+  //foreach (GeomSelection aSel, mySelection) {
+  //  QString aName(aSel.first->data()->name().c_str());
+  //  aName += ":" + aType + QString("_%1").arg(i);
+  //  myListControl->addItem(aName);
+  //  i++;
+  //}
+  //myListControl->repaint();
 }
index c38f72d072e1075be0c5c635abf627d9696d0570..47f08a5e683efd1f4696894f6df17029ab6e171e 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <GeomAPI_Shape.h>
 #include <ModelAPI_Result.h>
+#include <ModelAPI_AttributeSelectionList.h>
 
 #include <NCollection_List.hxx>
 #include <TopoDS_Shape.hxx>
@@ -67,7 +68,7 @@ class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_Model
   void activateShapeSelection();
 
  private:
-   void updateSelectionList();
+   void updateSelectionList(AttributeSelectionListPtr);
 
   QListWidget* myListControl;
   QComboBox* myTypeCombo;