Salome HOME
Use validators to set import file formats
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetPoint2D.cpp
index b20f2e8d7065077c142cdde128f593c3f631d74f..c6d341d002134e20b5c797013e147e080c3fb4c4 100644 (file)
@@ -5,6 +5,7 @@
 #include <ModuleBase_WidgetPoint2D.h>
 #include <ModuleBase_WidgetValueFeature.h>
 #include <ModuleBase_DoubleSpinBox.h>
+#include <ModuleBase_Tools.h>
 
 #include <Config_Keywords.h>
 #include <Config_WidgetAPI.h>
@@ -33,10 +34,12 @@ ModuleBase_WidgetPoint2D::ModuleBase_WidgetPoint2D(QWidget* theParent,
     : ModuleBase_ModelWidget(theParent, theData, theParentId)
 {
   myOptionParam = theData->getProperty(PREVIOUS_FEATURE_PARAM);
-  myGroupBox = new QGroupBox(QString::fromStdString(theData->getProperty(CONTAINER_PAGE_NAME)),
-                             theParent);
+  QString aPageName = QString::fromStdString(theData->getProperty(CONTAINER_PAGE_NAME));
+  myGroupBox = new QGroupBox(aPageName, theParent);
+  myGroupBox->setFlat(false);
+
   QGridLayout* aGroupLay = new QGridLayout(myGroupBox);
-  aGroupLay->setContentsMargins(2, 0, 2, 0);
+  ModuleBase_Tools::adjustMargins(aGroupLay);
   aGroupLay->setColumnStretch(1, 1);
   {
     QLabel* aLabel = new QLabel(myGroupBox);
@@ -66,8 +69,6 @@ ModuleBase_WidgetPoint2D::ModuleBase_WidgetPoint2D(QWidget* theParent,
 
     connect(myYSpin, SIGNAL(valueChanged(double)), this, SIGNAL(valuesChanged()));
   }
-  myXSpin->installEventFilter(this);
-  myYSpin->installEventFilter(this);
 }
 
 ModuleBase_WidgetPoint2D::~ModuleBase_WidgetPoint2D()
@@ -144,22 +145,6 @@ QList<QWidget*> ModuleBase_WidgetPoint2D::getControls() const
   return aControls;
 }
 
-bool ModuleBase_WidgetPoint2D::eventFilter(QObject *theObject, QEvent *theEvent)
-{
-  if (theObject == myXSpin || theObject == myYSpin) {
-    if (theEvent->type() == QEvent::KeyRelease) {
-      QKeyEvent* aKeyEvent = (QKeyEvent*) theEvent;
-      if (aKeyEvent && (aKeyEvent->key() == Qt::Key_Return ||
-                        aKeyEvent->key() == Qt::Key_Enter)) {
-        emit focusOutWidget(this);
-      }
-      emit keyReleased((QKeyEvent*) theEvent);
-      return true;
-    }
-  }
-  return ModuleBase_ModelWidget::eventFilter(theObject, theEvent);
-}
-
 bool ModuleBase_WidgetPoint2D::initFromPrevious(ObjectPtr theObject)
 {
   if (myOptionParam.length() == 0)