1 // File: ModuleBase_WidgetFeature.cpp
2 // Created: 25 Apr 2014
3 // Author: Natalia ERMOLAEVA
5 #include <ModuleBase_WidgetFeature.h>
7 #include <Config_Keywords.h>
8 #include <Config_WidgetAPI.h>
10 #include <Events_Loop.h>
11 #include <Model_Events.h>
13 #include <ModelAPI_Feature.h>
14 #include <ModelAPI_Data.h>
15 #include <ModelAPI_Object.h>
16 #include <ModelAPI_AttributeRefAttr.h>
20 ModuleBase_WidgetFeature::ModuleBase_WidgetFeature(QWidget* theParent,
21 const Config_WidgetAPI* theData)
22 : ModuleBase_ModelWidget(theParent, theData)
24 QString aKinds = QString::fromStdString(theData->getProperty(FEATURE_KEYSEQUENCE));
25 myFeatureKinds = aKinds.split(" ");
28 ModuleBase_WidgetFeature::~ModuleBase_WidgetFeature()
32 bool ModuleBase_WidgetFeature::setFeature(const FeaturePtr& theFeature)
34 if (!theFeature && myFeatureKinds.contains(theFeature->getKind().c_str()))
37 //bool isBlocked = this->blockSignals(true);
38 myFeature = theFeature;
39 //this->blockSignals(isBlocked);
44 bool ModuleBase_WidgetFeature::storeValue(FeaturePtr theFeature) const
46 boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
47 boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
48 boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
50 ModuleBase_WidgetFeature* that = (ModuleBase_WidgetFeature*) this;
51 //bool isBlocked = that->blockSignals(true);
52 aRef->setFeature(myFeature);
53 Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
54 //that->blockSignals(isBlocked);
59 bool ModuleBase_WidgetFeature::restoreValue(FeaturePtr theFeature)
61 boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
62 boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
63 boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
65 //bool isBlocked = this->blockSignals(true);
66 myFeature = aRef->feature();
67 //this->blockSignals(isBlocked);
71 QWidget* ModuleBase_WidgetFeature::getControl() const
76 QList<QWidget*> ModuleBase_WidgetFeature::getControls() const
78 QList<QWidget*> aControls;