1 // File: ModuleBase_ModelWidget.h
2 // Created: 25 Apr 2014
3 // Author: Natalia ERMOLAEVA
5 #include "ModuleBase_ModelWidget.h"
7 #include <ModelAPI_Data.h>
8 #include <ModelAPI_Attribute.h>
9 #include <ModelAPI_Events.h>
11 #include "Config_WidgetAPI.h"
13 #include <Events_Loop.h>
17 ModuleBase_ModelWidget::ModuleBase_ModelWidget(QObject* theParent, const Config_WidgetAPI* theData,
18 const std::string& theParentId)
20 myHasDefaultValue(false),
21 myParentId(theParentId)
23 myAttributeID = theData ? theData->widgetId() : "";
26 bool ModuleBase_ModelWidget::isInitialized(ObjectPtr theObject) const
28 return theObject->data()->attribute(attributeID())->isInitialized();
31 bool ModuleBase_ModelWidget::focusTo()
33 QList<QWidget*> aControls = getControls();
34 QList<QWidget*>::const_iterator anIt = aControls.begin(), aLast = aControls.end();
35 for (; anIt != aLast; anIt++) {
36 QWidget* aWidget = *anIt;
37 if (aWidget && aWidget->focusPolicy() != Qt::NoFocus) {
45 void ModuleBase_ModelWidget::updateObject(ObjectPtr theObj) const
47 Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
48 static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY);
49 ModelAPI_EventCreator::get()->sendUpdated(theObj, anEvent);