Salome HOME
Switch and Toolbox refactored: common methods are extracted into base class
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetLineEdit.cpp
index 19771a66fd10deb7b3fb7e3c22d546d1725582f1..9c4a1b00f068fd36b0ef838b9320ca9f5a9f0a5b 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
 /*
  * ModuleBase_WidgetLineEdit.cpp
  *
@@ -15,7 +17,7 @@
 
 #include <Config_WidgetAPI.h>
 
-#include <QHBoxLayout>
+#include <QFormLayout>
 #include <QLabel>
 #include <QLineEdit>
 #include <QObject>
@@ -29,16 +31,13 @@ ModuleBase_WidgetLineEdit::ModuleBase_WidgetLineEdit(QWidget* theParent,
                                                      const std::string& theParentId)
     : ModuleBase_ModelWidget(theParent, theData, theParentId)
 {
-  myMainWidget = new QWidget(theParent);
-  QHBoxLayout* aMainLay = new QHBoxLayout(myMainWidget);
+  QFormLayout* aMainLay = new QFormLayout(this);
   ModuleBase_Tools::adjustMargins(aMainLay);
   QString aTitle = QString::fromStdString(theData->widgetLabel());
-  QLabel* aTitleLabel = new QLabel(aTitle, myMainWidget);
-  aMainLay->addWidget(aTitleLabel);
-  myLineEdit = new QLineEdit(myMainWidget);
-  aMainLay->addWidget(myLineEdit);
+  myLineEdit = new QLineEdit(this);
   myLineEdit->setMinimumHeight(20);
-  myMainWidget->setLayout(aMainLay);
+  aMainLay->addRow(aTitle, myLineEdit);
+  this->setLayout(aMainLay);
 
   connect(myLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(onTextChanged()));
 }
@@ -47,7 +46,7 @@ ModuleBase_WidgetLineEdit::~ModuleBase_WidgetLineEdit()
 {
 }
 
-bool ModuleBase_WidgetLineEdit::storeValue() const
+bool ModuleBase_WidgetLineEdit::storeValueCustom() const
 {
   // A rare case when plugin was not loaded. 
   if(!myFeature)
@@ -75,11 +74,6 @@ bool ModuleBase_WidgetLineEdit::restoreValue()
   return true;
 }
 
-QWidget* ModuleBase_WidgetLineEdit::getControl() const
-{
-  return myMainWidget;
-}
-
 QList<QWidget*> ModuleBase_WidgetLineEdit::getControls() const
 {
   QList<QWidget*> result;