+bool PartSet_Module::createWidgets(ModuleBase_Operation* theOperation,
+ QList<ModuleBase_ModelWidget*>& theWidgets) const
+{
+ bool aProcessed = false;
+
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ XGUI_Workshop* aWorkshop = getWorkshop();
+ XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel();
+ if (mySketchMgr->activeSketch().get() && aFOperation && aPropertyPanel) {
+ ModuleBase_ISelection* aSelection = workshop()->selection();
+ // click on a point in sketch leads here with the point is highlighted, not yet selected
+ QList<ModuleBase_ViewerPrs> aPreselection = aSelection->getHighlighted();
+ if (aPreselection.size() == 1) {
+ ModuleBase_ViewerPrs aSelectedPrs = aPreselection[0];
+ ObjectPtr anObject = aSelectedPrs.object();
+
+ FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
+ FeaturePtr anOpFeature = aFOperation->feature();
+ TopoDS_Shape aShape = aSelectedPrs.shape();
+ // click on the digit of dimension constrain comes here with an empty shape, so we need the check
+ if (aFeature == anOpFeature && !aShape.IsNull()) {
+ AttributePtr anAttribute = PartSet_Tools::findAttributeBy2dPoint(anObject, aShape,
+ mySketchMgr->activeSketch());
+ if (anAttribute.get()) {
+ QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation();
+ ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), workshop());
+
+ const std::string anAttributeId = anAttribute->id();
+ aFactory.createWidget(aPropertyPanel->contentWidget(), anAttributeId);
+
+ theWidgets = aFactory.getModelWidgets();
+ // it is possible that the point does not present in XML definition,
+ // in this case, we assume that it is not processed by this module
+ // e.g. "Intersection point" feature
+ aProcessed = !theWidgets.isEmpty();
+ }
+ }
+ }
+ }
+ return aProcessed;
+}