1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModuleBase_WidgetLabel.cpp
4 // Created: 03 Dec 2014
5 // Author: Vitaly SMETANNIKOV
7 #include "ModuleBase_WidgetLabel.h"
9 #include <Config_WidgetAPI.h>
10 #include <Config_Keywords.h>
11 #include <ModuleBase_Tools.h>
13 #include <ModelAPI_AttributeString.h>
16 #include <QVBoxLayout>
19 ModuleBase_WidgetLabel::ModuleBase_WidgetLabel(QWidget* theParent,
20 const Config_WidgetAPI* theData)
21 : ModuleBase_ModelWidget(theParent, theData)
23 QString aText = QString::fromStdString(theData->getProperty("title"));
24 myLabel = new QLabel(aText, theParent);
25 myLabel->setWordWrap(true);
26 myLabel->setIndent(5);
27 myLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
28 myLabel->setContentsMargins(0,0,0,4);
30 QVBoxLayout* aLayout = new QVBoxLayout(this);
31 ModuleBase_Tools::zeroMargins(aLayout);
32 aLayout->addWidget(myLabel);
35 std::string aStyleSheet = theData->getProperty(ATTR_STYLE_SHEET).c_str();
36 if (!aStyleSheet.empty())
37 myLabel->setStyleSheet(QString("QLabel {%1}").arg(aStyleSheet.c_str()));
40 ModuleBase_WidgetLabel::~ModuleBase_WidgetLabel()
44 QList<QWidget*> ModuleBase_WidgetLabel::getControls() const
46 return QList<QWidget*>();
49 bool ModuleBase_WidgetLabel::restoreValueCustom()
51 DataPtr aData = myFeature->data();
52 AttributeStringPtr aStrAttr = aData->string(attributeID());
56 aMsg = aStrAttr->value();
58 myLabel->setText(aMsg.c_str());
63 bool ModuleBase_WidgetLabel::focusTo()