X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_ModelWidget.cpp;h=5a6ba6e1eb5b8032feef6a283c3cc5e09b16c8c1;hb=cdd9efd8fbc75f120188ae16eed7471dc6492ac3;hp=e2b934ee6de130eff7fab5672b876f9a0daf21e6;hpb=12866ad4430e2c7b4fe186d7117291e7aa09a18e;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index e2b934ee6..5a6ba6e1e 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -26,7 +26,6 @@ ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent, const Config_ myParentId(theParentId) { myIsComputedDefault = false; - myIsObligatory = theData ? theData->getBooleanAttribute(FEATURE_OBLIGATORY, true) : true; myAttributeID = theData ? theData->widgetId() : ""; } @@ -39,9 +38,8 @@ void ModuleBase_ModelWidget::enableFocusProcessing() { QList aMyControls = getControls(); foreach(QWidget* eachControl, aMyControls) { - if(!myFocusInWidgets.contains(eachControl)) { - enableFocusProcessing(eachControl); - } + eachControl->setFocusPolicy(Qt::StrongFocus); + eachControl->installEventFilter(this); } } @@ -92,20 +90,15 @@ void ModuleBase_ModelWidget::updateObject(ObjectPtr theObj) const ModelAPI_EventCreator::get()->sendUpdated(theObj, anEvent); } -void ModuleBase_ModelWidget::enableFocusProcessing(QWidget* theWidget) -{ - theWidget->setFocusPolicy(Qt::StrongFocus); - theWidget->installEventFilter(this); - myFocusInWidgets.append(theWidget); -} - bool ModuleBase_ModelWidget::eventFilter(QObject* theObject, QEvent *theEvent) { QWidget* aWidget = qobject_cast(theObject); - if (theEvent->type() == QEvent::MouseButtonRelease && - myFocusInWidgets.contains(aWidget)) { - emit focusInWidget(this); + if (theEvent->type() == QEvent::FocusIn) { + if (getControls().contains(aWidget)) { + emit focusInWidget(this); + } } // pass the event on to the parent class + return QObject::eventFilter(theObject, theEvent); }