]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'master' of newgeom:newgeom.git
authorsbh <sergey.belash@opencascade.com>
Thu, 9 Oct 2014 10:15:11 +0000 (14:15 +0400)
committersbh <sergey.belash@opencascade.com>
Thu, 9 Oct 2014 10:15:11 +0000 (14:15 +0400)
1  2 
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
src/ModuleBase/ModuleBase_WidgetShapeSelector.h

index c800f9a7d4f5b8511647cd22207ab90cec35e069,29443bf5d3f12fd85cad14cab528e58a1f082cb8..b73adf626a29fbfcf45c646e20823f2f5fdd9b63
@@@ -49,9 -49,8 +49,9 @@@ TopAbs_ShapeEnum ModuleBase_WidgetShape
      MyShapeTypes["shell"] = TopAbs_SHELL;
      MyShapeTypes["solid"] = TopAbs_SOLID;
    }
 -  if (MyShapeTypes.contains(theType))
 -    return MyShapeTypes[theType];
 +  QString aType = theType.toLower();
 +  if (MyShapeTypes.contains(aType))
 +    return MyShapeTypes[aType];
    throw std::invalid_argument("Shape type defined in XML is not implemented!");
  }
  
@@@ -60,7 -59,7 +60,7 @@@ ModuleBase_WidgetShapeSelector::ModuleB
                                                       const Config_WidgetAPI* theData,
                                                       const std::string& theParentId)
      : ModuleBase_ModelWidget(theParent, theData, theParentId),
-       myWorkshop(theWorkshop), myIsActive(false)
+       myWorkshop(theWorkshop), myIsActive(false), myUseSubShapes(false)
  {
    myContainer = new QWidget(theParent);
    QHBoxLayout* aLayout = new QHBoxLayout(myContainer);
  
    std::string aTypes = theData->getProperty("shape_types");
    myShapeTypes = QString(aTypes.c_str()).split(' ');
+   std::string aUseSubShapes = theData->getProperty("use_subshapes");
+   if (aUseSubShapes.length() > 0) {
+     QString aVal(aUseSubShapes.c_str());
+     myUseSubShapes = (aVal.toUpper() == "TRUE");
+   }
  }
  
  //********************************************************************
@@@ -251,10 -256,19 +257,19 @@@ void ModuleBase_WidgetShapeSelector::ac
      myTextLine->setPalette(myInactivePalet);
    updateSelectionName();
  
-   if (myIsActive)
+   if (myIsActive) {
      connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
-   else
+     if (myUseSubShapes) {
+       QIntList aList;
+       foreach (QString aType, myShapeTypes)
+         aList.append(shapeType(aType));
+       myWorkshop->activateSubShapesSelection(aList);
+     }
+   } else {
      disconnect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
+     if (myUseSubShapes) 
+       myWorkshop->deactivateSubShapesSelection();
+   }
  }
  
  //********************************************************************
index 7446122705d4af04dddb8dc2c8fc460cd363a11d,75863884304d906e8bcb6174f875575ef005bac0..aa79150bfa3152375b4e6aa08d1b40b871376fab
@@@ -26,8 -26,6 +26,8 @@@ class MODULEBASE_EXPORT ModuleBase_Widg
  {
  Q_OBJECT
   public:
 +  static TopAbs_ShapeEnum shapeType(const QString& theType);
 +
    ModuleBase_WidgetShapeSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
                              const Config_WidgetAPI* theData, const std::string& theParentId);
  
@@@ -81,6 -79,8 +81,6 @@@ private
    // Set the given object as a value of the widget
    void setObject(ObjectPtr theObj);
  
 -  static TopAbs_ShapeEnum shapeType(const QString& theType);
 -
    QWidget* myContainer;
    QLabel* myLabel;
    QLineEdit* myTextLine;
@@@ -91,6 -91,9 +91,9 @@@
    ObjectPtr mySelectedObject;
    QStringList myShapeTypes;
  
+   /// If true then local selector has to be activated in context
+   bool myUseSubShapes;
    QPalette myBasePalet;
    QPalette myInactivePalet;