1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModuleBase_WidgetErrorLabel.cpp
4 // Created: 03 Dec 2014
5 // Author: Vitaly SMETANNIKOV
7 #include "ModuleBase_WidgetErrorLabel.h"
9 #include <Config_WidgetAPI.h>
10 #include <ModuleBase_Tools.h>
11 #include <ModelAPI_AttributeString.h>
16 ModuleBase_WidgetErrorLabel::ModuleBase_WidgetErrorLabel(QWidget* theParent,
17 const Config_WidgetAPI* theData,
18 const std::string& theParentId)
19 : ModuleBase_WidgetLabel(theParent, theData, theParentId)
21 myDefaultStyle = myLabel->styleSheet();
22 myLabel->setContentsMargins(0,0,0,4);
23 myLabel->setWordWrap(true);
24 myLabel->installEventFilter(this);
27 ModuleBase_WidgetErrorLabel::~ModuleBase_WidgetErrorLabel()
31 bool ModuleBase_WidgetErrorLabel::restoreValueCustom()
33 DataPtr aData = myFeature->data();
34 AttributeStringPtr aStrAttr = aData->string(attributeID());
37 aMsg = aStrAttr->value();
41 myLabel->setStyleSheet(myDefaultStyle);
43 myLabel->setText(aMsg.c_str());
44 //myLabel->setStyleSheet("QLabel { color : red; font : italic }");
45 myLabel->setStyleSheet("QLabel { color : red; font : bold }");
46 //myLabel->setStyleSheet("QLabel { border: 1px solid red; }");
52 bool ModuleBase_WidgetErrorLabel::focusTo()
58 bool ModuleBase_WidgetErrorLabel::eventFilter(QObject* theObj, QEvent* theEvent)
60 if (theObj == myLabel) {
61 if (theEvent->type() == QEvent::Show)
64 return ModuleBase_WidgetLabel::eventFilter(theObj, theEvent);