1 // Copyright (C) 2014-2016 CEA/DEN, EDF R&D
3 // File: ModuleBase_WidgetLabelValue.cpp
4 // Created: 30 Nov 2016
5 // Author: Natalia ERMOLAEVA
7 #include "ModuleBase_WidgetLabelValue.h"
9 #include <Config_WidgetAPI.h>
10 #include <Config_Keywords.h>
11 #include <ModuleBase_LabelValue.h>
13 #include <ModelAPI_AttributeDouble.h>
16 #include <QVBoxLayout>
18 ModuleBase_WidgetLabelValue::ModuleBase_WidgetLabelValue(QWidget* theParent,
19 const Config_WidgetAPI* theData)
20 : ModuleBase_ModelWidget(theParent, theData)
22 QVBoxLayout* aLayout = new QVBoxLayout(this);
23 aLayout->setContentsMargins(0, 0, 0, 0);
24 aLayout->setSpacing(0);
26 QString aText = QString::fromStdString(theData->widgetLabel());
27 QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
28 QString aToolTip = QString::fromStdString(theData->widgetTooltip());
30 myLabel = new ModuleBase_LabelValue(theParent, aText, aToolTip, aLabelIcon);
31 aLayout->addWidget(myLabel);
34 ModuleBase_WidgetLabelValue::~ModuleBase_WidgetLabelValue()
38 QList<QWidget*> ModuleBase_WidgetLabelValue::getControls() const
40 return QList<QWidget*>();
43 bool ModuleBase_WidgetLabelValue::restoreValueCustom()
45 DataPtr aData = myFeature->data();
46 AttributeDoublePtr anAttribute = aData->real(attributeID());
48 if (anAttribute.get() && anAttribute->isInitialized())
49 aValue = anAttribute->value();
50 myLabel->setValue(aValue);
54 bool ModuleBase_WidgetLabelValue::storeValueCustom()