]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
Salome HOME
Add tools
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetMultiSelector.cpp
index a7025605a33498387f021540810e65fd46cfad20..8a703d3208963f6d253f7ad3863b2b09510c431c 100755 (executable)
@@ -15,8 +15,6 @@
 #include <ModuleBase_Tools.h>
 #include <ModuleBase_Definitions.h>
 
-#include <GeomValidators_ShapeType.h>
-
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Object.h>
 #include <ModelAPI_AttributeSelectionList.h>
@@ -79,14 +77,15 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
 
   std::string aPropertyTypes = theData->getProperty("type_choice");
   QString aTypesStr = aPropertyTypes.c_str();
-  QStringList aShapeTypes = aTypesStr.split(' ');
+  QStringList aShapeTypes = aTypesStr.split(' ', QString::SkipEmptyParts);
 
   myIsUseChoice = theData->getBooleanAttribute("use_choice", true);
 
-  myTypeCombo->addItems(aShapeTypes);
+  if (!aShapeTypes.empty())
+    myTypeCombo->addItems(aShapeTypes);
   aMainLay->addWidget(myTypeCombo, 0, 1);
   // if the xml definition contains one type, the controls to select a type should not be shown
-  if (aShapeTypes.size() == 1 || !myIsUseChoice) {
+  if (aShapeTypes.size() <= 1 || !myIsUseChoice) {
     aTypeLabel->setVisible(false);
     myTypeCombo->setVisible(false);
   }
@@ -96,7 +95,7 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
                                                       : tr("Selected objects:"), this);
   aMainLay->addWidget(aListLabel, 1, 0);
   // if the xml definition contains one type, an information label should be shown near to the latest
-  if (aShapeTypes.size() == 1) {
+  if (aShapeTypes.size() <= 1) {
     QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
     if (!aLabelIcon.isEmpty()) {
       QLabel* aSelectedLabel = new QLabel("", this);
@@ -193,11 +192,9 @@ void ModuleBase_WidgetMultiSelector::restoreAttributeValue(bool theValid)
   else {
     AttributeRefListPtr aRefListAttr = myFeature->data()->reflist(attributeID());
     // restore objects in the attribute. Indeed there is only one stored object
-#ifdef DEBUG_REFLIST
     int aCountAppened = aRefListAttr->size() - mySelectionCount;
     for (int i = 0; i < aCountAppened; i++)
       aRefListAttr->removeLast();
-#endif
   }
 }
 
@@ -332,7 +329,10 @@ QIntList ModuleBase_WidgetMultiSelector::getShapeTypes() const
   }
   else {
     for (int i = 0, aCount = myTypeCombo->count(); i < aCount; i++) {
-      aShapeTypes.append(ModuleBase_Tools::shapeType(myTypeCombo->itemText(i)));
+      TopAbs_ShapeEnum aType = ModuleBase_Tools::shapeType(myTypeCombo->itemText(i));
+      aShapeTypes.append(aType);
+      if (aType == TopAbs_SOLID)
+        aShapeTypes.append(TopAbs_COMPSOLID);
     }
   }
   return aShapeTypes;