metaforce/metaforce-gui/ErrorLabel.hpp

18 lines
446 B
C++
Raw Normal View History

2018-10-07 03:41:18 +00:00
#pragma once
#include <QLabel>
2018-12-08 05:19:40 +00:00
class ErrorLabel : public QLabel {
public:
2018-12-08 05:19:40 +00: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);
}
};