]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #220: proper work for multiselection widget on shape type changing.
authorsbh <sergey.belash@opencascade.com>
Fri, 31 Oct 2014 15:41:16 +0000 (18:41 +0300)
committersbh <sergey.belash@opencascade.com>
Fri, 31 Oct 2014 15:41:16 +0000 (18:41 +0300)
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.h

index 227ec15863e74c2b089aca04513948391bc7e7c7..84b0feb65cd220af4a43a2e9f72727c785c10fdd 100644 (file)
@@ -79,7 +79,7 @@ bool ModuleBase_WidgetMultiSelector::storeValue() const
   AttributeSelectionListPtr aSelectionListAttr = 
     boost::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
 
-  if (aSelectionListAttr && (mySelection.size() > 0)) {
+  if (aSelectionListAttr) {
     aSelectionListAttr->clear();
     // Store shapes type
     TopAbs_ShapeEnum aCurrentType =
@@ -165,7 +165,6 @@ void ModuleBase_WidgetMultiSelector::onSelectionChanged()
     mySelection.append(GeomSelection(aResult, aShape));
   }
   updateSelectionList();
-  storeValue();
   emit valuesChanged();
 }
 
@@ -232,19 +231,26 @@ void ModuleBase_WidgetMultiSelector::activateSelection(bool toActivate)
   myIsActive = toActivate;
   if (myIsActive) {
     connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
-    onSelectionTypeChanged();
+    //onSelectionTypeChanged();
   } else {
     disconnect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
     myWorkshop->deactivateSubShapesSelection();
   }
 }
 
-//********************************************************************
-void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()
+void ModuleBase_WidgetMultiSelector::activateShapeSelection()
 {
-  myListControl->clear();
   QString aNewType = myTypeCombo->currentText();
   QIntList aList;
   aList.append(ModuleBase_WidgetShapeSelector::shapeType(aNewType));
   myWorkshop->activateSubShapesSelection(aList);
 }
+
+//********************************************************************
+void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()
+{
+  QList<ObjectPtr> anEmptyList;
+  myWorkshop->setSelected(anEmptyList);
+  activateShapeSelection();
+  onSelectionChanged();
+}
index a456a10dc30f68e4cca4dcea030596e6160fecdf..f94a19e2fab4dee39ccf373b9f34c9295f14c542 100644 (file)
@@ -62,6 +62,7 @@ class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_Model
   void filterShapes(const NCollection_List<TopoDS_Shape>& theShapesToFilter,
                     NCollection_List<TopoDS_Shape>& theResult);
   void setCurrentShapeType(const TopAbs_ShapeEnum theShapeType);
+  void activateShapeSelection();
 
  private:
    void updateSelectionList();