- if (MyShapeTypes.count() == 0) {
- MyShapeTypes["face"] = TopAbs_FACE;
- MyShapeTypes["vertex"] = TopAbs_VERTEX;
- MyShapeTypes["wire"] = TopAbs_WIRE;
- MyShapeTypes["edge"] = TopAbs_EDGE;
- MyShapeTypes["shell"] = TopAbs_SHELL;
- MyShapeTypes["solid"] = TopAbs_SOLID;
- }
- if (MyShapeTypes.contains(theType))
- return MyShapeTypes[theType];
- throw std::invalid_argument("Shape type defined in XML is not implemented!");
-}
-
-
-
-
-ModuleBase_WidgetSelector::ModuleBase_WidgetSelector(QWidget* theParent,
- ModuleBase_IWorkshop* theWorkshop,
- const Config_WidgetAPI* theData)
-: ModuleBase_ModelWidget(theParent, theData), myWorkshop(theWorkshop), myActivateOnStart(false)
-{
- myContainer = new QWidget(theParent);
- QHBoxLayout* aLayout = new QHBoxLayout(myContainer);
-
- aLayout->setContentsMargins(0, 0, 0, 0);
- QString aLabelText = QString::fromStdString(theData->widgetLabel());
- QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
- myLabel = new QLabel(aLabelText, myContainer);
- myLabel->setPixmap(QPixmap(aLabelIcon));
-
- aLayout->addWidget(myLabel);
-
- QString aToolTip = QString::fromStdString(theData->widgetTooltip());
- myTextLine = new QLineEdit(myContainer);
- myTextLine->setReadOnly(true);
- myTextLine->setToolTip(aToolTip);
- myTextLine->installEventFilter(this);
-
- aLayout->addWidget(myTextLine);
-
- myActivateBtn = new QToolButton(myContainer);
- myActivateBtn->setIcon(QIcon(":icons/hand_point.png"));
- myActivateBtn->setCheckable(true);
- myActivateBtn->setToolTip(tr("Activate/Deactivate selection"));
- connect(myActivateBtn, SIGNAL(toggled(bool)), this, SLOT(activateSelection(bool)));
-
- aLayout->addWidget(myActivateBtn);
-
- QString aActivateTxt = QString::fromStdString(theData->getProperty("activate"));
- if (!aActivateTxt.isNull()) {
- myActivateOnStart = (aActivateTxt == "true");
- }
-
- std::string aTypes = theData->getProperty("shape_types");
- myShapeTypes = QString(aTypes.c_str()).split(',');