1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModuleBase_IWorkshop.cpp
4 // Created: 30 Nov 2016
5 // Author: Natalia ERMOLAEVA
7 #include <ModuleBase_LabelValue.h>
8 #include <ModuleBase_IconFactory.h>
10 #include <QHBoxLayout>
13 ModuleBase_LabelValue::ModuleBase_LabelValue(QWidget* theParent, const QString& theText,
14 const QString& theToolTip, const QString& theIcon)
17 QHBoxLayout* aLayout = new QHBoxLayout(this);
18 aLayout->setContentsMargins(2, 0, 0, 0);
19 aLayout->setSpacing(0);
21 myLabel = new QLabel(QString("%1 : ").arg(theText), this);
22 if (!theIcon.isEmpty()) {
23 myLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(theIcon));
24 aLayout->setSpacing(4);
26 myLabel->setToolTip(!theToolTip.isEmpty() ? theToolTip : theText);
27 aLayout->addWidget(myLabel);
29 myLabelValue = new QLabel("", this);
30 aLayout->addWidget(myLabelValue, 1);
32 aLayout->addStretch(1);
35 ModuleBase_LabelValue::~ModuleBase_LabelValue()
39 void ModuleBase_LabelValue::setValue(const double theValue)
42 myLabelValue->setText(QString::number(theValue));
43 myLabelValue->setToolTip(QString::number(theValue));