X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FModuleBase%2FModuleBase_WidgetDoubleValue.cpp;h=4053a2a4b6c8d33f25b9c116462d7d9d3ca93555;hb=9d5239835cc367320272dd367a2e6453e109c91d;hp=2b5437e46910ab5df783ff68054e89ec6303a9a7;hpb=2d5cbfca3d96c8251370fc563d2d675650aabd28;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index 2b5437e46..4053a2a4b 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include @@ -37,18 +37,16 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, const std::string& theParentId) : ModuleBase_ModelWidget(theParent, theData, theParentId) { - myContainer = new QWidget(theParent); - QHBoxLayout* aControlLay = new QHBoxLayout(myContainer); + QFormLayout* aControlLay = new QFormLayout(this); ModuleBase_Tools::adjustMargins(aControlLay); QString aLabelText = QString::fromStdString(theData->widgetLabel()); QString aLabelIcon = QString::fromStdString(theData->widgetIcon()); - myLabel = new QLabel(aLabelText, myContainer); + myLabel = new QLabel(aLabelText, this); if (!aLabelIcon.isEmpty()) myLabel->setPixmap(QPixmap(aLabelIcon)); - aControlLay->addWidget(myLabel); - mySpinBox = new ModuleBase_DoubleSpinBox(myContainer); + mySpinBox = new ModuleBase_DoubleSpinBox(this); QString anObjName = QString::fromStdString(attributeID()); mySpinBox->setObjectName(anObjName); @@ -87,9 +85,7 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, QString aTTip = QString::fromStdString(theData->widgetTooltip()); mySpinBox->setToolTip(aTTip); - aControlLay->addWidget(mySpinBox); - aControlLay->setStretch(1, 1); - + aControlLay->addRow(myLabel, mySpinBox); connect(mySpinBox, SIGNAL(valueChanged(double)), this, SIGNAL(valuesChanged())); } @@ -108,10 +104,11 @@ void ModuleBase_WidgetDoubleValue::reset() bool isOk; double aDefValue = QString::fromStdString(getDefaultValue()).toDouble(&isOk); ModuleBase_Tools::setSpinValue(mySpinBox, isOk ? aDefValue : 0.0); + storeValueCustom(); } } -bool ModuleBase_WidgetDoubleValue::storeValue() const +bool ModuleBase_WidgetDoubleValue::storeValueCustom() const { DataPtr aData = myFeature->data(); AttributeDoublePtr aReal = aData->real(attributeID());