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!");
}
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");
+ }
}
//********************************************************************
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();
+ }
}
//********************************************************************
{
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);
// 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;
ObjectPtr mySelectedObject;
QStringList myShapeTypes;
+ /// If true then local selector has to be activated in context
+ bool myUseSubShapes;
+
QPalette myBasePalet;
QPalette myInactivePalet;