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 : ModuleBase_WidgetLabel(theParent, theData)
20 myDefaultStyle = myLabel->styleSheet();
21 myLabel->setContentsMargins(0,0,0,4);
22 myLabel->setWordWrap(true);
23 myLabel->installEventFilter(this);
26 ModuleBase_WidgetErrorLabel::~ModuleBase_WidgetErrorLabel()
30 bool ModuleBase_WidgetErrorLabel::restoreValueCustom()
32 DataPtr aData = myFeature->data();
33 AttributeStringPtr aStrAttr = aData->string(attributeID());
36 aMsg = aStrAttr->value();
40 myLabel->setStyleSheet(myDefaultStyle);
42 myLabel->setText(aMsg.c_str());
43 //myLabel->setStyleSheet("QLabel { color : red; font : italic }");
44 myLabel->setStyleSheet("QLabel { color : red; font : bold }");
45 //myLabel->setStyleSheet("QLabel { border: 1px solid red; }");
51 bool ModuleBase_WidgetErrorLabel::focusTo()
57 bool ModuleBase_WidgetErrorLabel::eventFilter(QObject* theObj, QEvent* theEvent)
59 if (theObj == myLabel) {
60 if (theEvent->type() == QEvent::Show)
63 return ModuleBase_WidgetLabel::eventFilter(theObj, theEvent);