#include <ModuleBase_WidgetChoice.h>
#include <ModuleBase_IWorkshop.h>
#include <ModuleBase_IModule.h>
+#include <ModuleBase_Tools.h>
+
+#include <ModelAPI_Validator.h>
#include <Config_Keywords.h>
#include <Config_WidgetAPI.h>
return;
QVBoxLayout* aWidgetLay = new QVBoxLayout(theParent);
- aWidgetLay->setContentsMargins(2, 2, 2, 2);
do { //Iterate over each node
std::string aWdgType = myWidgetApi->widgetType();
//Create a widget (doublevalue, groupbox, toolbox, etc.
//if current widget is groupbox (container) process it's children recursively
QString aGroupName = qs(myWidgetApi->getProperty(CONTAINER_PAGE_NAME));
createWidget(aWidget);
+ ModuleBase_Tools::adjustMargins(aWidget);
QGroupBox* aGrBox = qobject_cast<QGroupBox*>(aWidget);
aGrBox->setTitle(aGroupName);
}
do {
QString aPageName = qs(myWidgetApi->getProperty(CONTAINER_PAGE_NAME));
QWidget* aPage = new QWidget(aWidget);
+ ModuleBase_Tools::adjustMargins(aPage);
createWidget(aPage);
if (aWdgType == WDG_SWITCH) {
ModuleBase_WidgetSwitch* aSwitch = qobject_cast<ModuleBase_WidgetSwitch*>(aWidget);
if (!result) {qDebug("ModuleBase_WidgetFactory::fillWidget: find bad widget type");}
#endif
}
+ if (result) {
+ // register that this attribute in feature is not obligatory for the feature execution
+ // so, it is not needed for the standard validation mechanism
+ bool isObligatory =
+ myWidgetApi ? myWidgetApi->getBooleanAttribute(FEATURE_OBLIGATORY, true) : true;
+ if (!isObligatory) {
+ ModelAPI_Session::get()->validators()->registerNotObligatory(
+ myParentId, myWidgetApi->widgetId());
+ }
+ }
+
return result;
}