9 #include "ui_validationindicator.h"
18 namespace swift::gui::editors
20 CValidationIndicator::CValidationIndicator(QWidget *parent) : QFrame(parent), ui(new Ui::
CValidationIndicator)
24 this->setFrameStyle(QFrame::StyledPanel);
25 this->setFrameShadow(QFrame::Raised);
26 this->setAutoFillBackground(
true);
27 m_originalStyleSheet = this->styleSheet();
29 m_resetTimer.setObjectName(this->objectName().append(
":").append(
"resetTimer"));
30 m_resetTimer.start(ResetInterval);
38 this->setBackgroundColor(
"green");
39 ui->lbl_Icon->setPixmap(CIcons::tick16());
45 this->setBackgroundColor(
"red");
46 ui->lbl_Icon->setPixmap(CStatusMessage::convertToIcon(CStatusMessage::SeverityError));
52 this->setBackgroundColor(
"yellow");
53 ui->lbl_Icon->setPixmap(CStatusMessage::convertToIcon(CStatusMessage::SeverityWarning));
58 this->setBackgroundColor(
"");
59 ui->lbl_Icon->clear();
82 void CValidationIndicator::setBackgroundColor(
const QString &colorName)
84 if (colorName.isEmpty()) { this->setStyleSheet(m_originalStyleSheet); }
88 const QString s(
"background-color: %1; background-image: url(:/own/icons/own/transparent1px.png);");
89 this->setStyleSheet(s.arg(colorName));
90 m_resetTimer.start(ResetInterval);
static bool useStyleSheetInDerivedWidget(QWidget *derivedWidget, QStyle::PrimitiveElement element=QStyle::PE_Widget)
Use style sheets in derived widgets.
Indication state of validation.
void setState(bool ok)
Ok or failed validation?
void passed()
Validation passed.
void warnings()
Passed with warnings.
void failed()
Validation failed.
virtual void paintEvent(QPaintEvent *paintEvent)
void clear()
Cleared state.
~CValidationIndicator()
Destructor.
Status messages, e.g. from Core -> GUI.
bool hasWarningMessages() const
Warning messages.
bool hasErrorMessages() const
Error messages.
Free functions in swift::misc.