2018-10-06 20:41:18 -07:00
|
|
|
#pragma once
|
2018-01-01 16:58:38 -08:00
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
2018-12-07 21:19:40 -08:00
|
|
|
class ErrorLabel : public QLabel {
|
2018-01-01 16:58:38 -08:00
|
|
|
public:
|
2018-12-07 21:19:40 -08:00
|
|
|
ErrorLabel(QWidget* parent = Q_NULLPTR) : QLabel(parent) {}
|
|
|
|
void setText(const QString& str, bool success = false) {
|
|
|
|
QPalette pal = QLabel::palette();
|
|
|
|
if (success)
|
|
|
|
pal.setColor(QPalette::WindowText, QColor(0, 255, 0));
|
|
|
|
else
|
|
|
|
pal.setColor(QPalette::WindowText, QColor(255, 47, 0));
|
|
|
|
QLabel::setPalette(pal);
|
|
|
|
QLabel::setText(str);
|
|
|
|
}
|
2018-01-01 16:58:38 -08:00
|
|
|
};
|