#include <ModelAPI_AttributeString.h>
#include <QLabel>
+#include <QEvent>
ModuleBase_WidgetErrorLabel::ModuleBase_WidgetErrorLabel(QWidget* theParent,
const Config_WidgetAPI* theData,
: ModuleBase_WidgetLabel(theParent, theData, theParentId)
{
myDefaultStyle = myLabel->styleSheet();
+ myLabel->setContentsMargins(0,0,0,4);
+ myLabel->setWordWrap(true);
+ myLabel->installEventFilter(this);
}
ModuleBase_WidgetErrorLabel::~ModuleBase_WidgetErrorLabel()
myLabel->setStyleSheet(myDefaultStyle);
} else {
myLabel->setText(aMsg.c_str());
- myLabel->setStyleSheet("QLabel { background-color : red; color : white; }");
+ //myLabel->setStyleSheet("QLabel { color : red; font : italic }");
+ myLabel->setStyleSheet("QLabel { color : red; font : bold }");
+ //myLabel->setStyleSheet("QLabel { border: 1px solid red; }");
}
return true;
}
+
+
+bool ModuleBase_WidgetErrorLabel::focusTo()
+{
+ restoreValue();
+ return false;
+}
+
+bool ModuleBase_WidgetErrorLabel::eventFilter(QObject* theObj, QEvent* theEvent)
+{
+ if (theObj == myLabel) {
+ if (theEvent->type() == QEvent::Show)
+ restoreValue();
+ }
+ return ModuleBase_WidgetLabel::eventFilter(theObj, theEvent);
+}