Salome HOME
Merge branch 'Dev_1.2.0' of newgeom:newgeom into Dev_1.2.0
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetLineEdit.cpp
index c25c3befade9d54df48ca1e9698bf33015123b75..1f1dbd5349d34d63f97060c31ba924cdd8075f1d 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <Config_WidgetAPI.h>
 
-#include <QHBoxLayout>
+#include <QFormLayout>
 #include <QLabel>
 #include <QLineEdit>
 #include <QObject>
@@ -31,16 +31,18 @@ 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);
+  QString aLabelText = QString::fromStdString(theData->widgetLabel());
+  QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
+  QLabel* aLabel = new QLabel(aLabelText, this);
+  if (!aLabelIcon.isEmpty())
+    aLabel->setPixmap(QPixmap(aLabelIcon));
+
+  myLineEdit = new QLineEdit(this);
   myLineEdit->setMinimumHeight(20);
-  myMainWidget->setLayout(aMainLay);
+  aMainLay->addRow(aLabel, myLineEdit);
+  this->setLayout(aMainLay);
 
   connect(myLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(onTextChanged()));
 }
@@ -77,11 +79,6 @@ bool ModuleBase_WidgetLineEdit::restoreValue()
   return true;
 }
 
-QWidget* ModuleBase_WidgetLineEdit::getControl() const
-{
-  return myMainWidget;
-}
-
 QList<QWidget*> ModuleBase_WidgetLineEdit::getControls() const
 {
   QList<QWidget*> result;