X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetLineEdit.cpp;h=1f1dbd5349d34d63f97060c31ba924cdd8075f1d;hb=c8e35a67c60489a46aaf7c8ff75001511ac2635b;hp=bf311c59f51979de549a89f7b5754f28ea104a3a;hpb=87c2d038fe6feaae3951850cbfb43313015aa1f7;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp b/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp index bf311c59f..1f1dbd534 100644 --- a/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp +++ b/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + /* * ModuleBase_WidgetLineEdit.cpp * @@ -15,13 +17,13 @@ #include -#include +#include #include #include #include #include -#include +#include #include ModuleBase_WidgetLineEdit::ModuleBase_WidgetLineEdit(QWidget* theParent, @@ -29,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())); } @@ -47,7 +51,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 +79,6 @@ bool ModuleBase_WidgetLineEdit::restoreValue() return true; } -QWidget* ModuleBase_WidgetLineEdit::getControl() const -{ - return myMainWidget; -} - QList ModuleBase_WidgetLineEdit::getControls() const { QList result;