#include <ModuleBase_WidgetValueFeature.h>
#include <ModuleBase_WidgetValue.h>
+#include <ModuleBase_Tools.h>
#include <Config_Keywords.h>
#include <Config_WidgetAPI.h>
#include <ModelAPI_Validator.h>
#include <ModelAPI_ResultValidator.h>
#include <ModelAPI_RefAttrValidator.h>
+#include <ModelAPI_Session.h>
#include <QWidget>
#include <QLineEdit>
{
myContainer = new QWidget(theParent);
QHBoxLayout* aControlLay = new QHBoxLayout(myContainer);
- aControlLay->setContentsMargins(0, 0, 0, 0);
+ ModuleBase_Tools::adjustMargins(aControlLay);
QString aLabelText = QString::fromStdString(theData->widgetLabel());
myLabel = new QLabel(aLabelText, myContainer);
QString aTTip = QString::fromStdString(theData->widgetTooltip());
myEditor->setToolTip(aTTip);
-
aControlLay->addWidget(myEditor);
aControlLay->setStretch(1, 1);
}
bool ModuleBase_WidgetFeature::setObject(const ObjectPtr& theObject, bool theSendEvent)
{
- PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
+ SessionPtr aMgr = ModelAPI_Session::get();
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
std::list<ModelAPI_Validator*> aValidators;
std::list<std::list<std::string> > anArguments;
boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
- ObjectPtr aObj = aRef->object();
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aRef->object());
- if (aFeature) {
- myObject = aFeature;
+ ObjectPtr anObjPtr = aRef->object();
+ if (anObjPtr) {
+ myObject = anObjPtr;
myEditor->setText(myObject ? myObject->data()->name().c_str() : "");
return true;
}