Salome HOME
Property panel widgets redesign
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetLineEdit.cpp
index 91af0aa943e439ddcaa37006ed11809bfbf31ec1..3930efe15081bbb2bb67ca10e5536c226f1cef09 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <Config_WidgetAPI.h>
 
-#include <QHBoxLayout>
+#include <QFormLayout>
 #include <QLabel>
 #include <QLineEdit>
 #include <QObject>
@@ -31,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()));
 }
@@ -77,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;