yhkylin-backup-tools/kybackup/component/circlelabel.h

36 lines
777 B
C++
Executable File

#ifndef CIRCLELABEL_H
#define CIRCLELABEL_H
#include <QLabel>
#include <QPaintEvent>
#include <QColor>
class CircleLable : public QLabel
{
Q_OBJECT
public:
CircleLable(const QString& text, QWidget* parent = nullptr, int size = 24, QColor backgroundColor = QColor(0xCC, 0xCC, 0xCC));
virtual ~CircleLable();
void setText(const QString& text) {
m_text = text;
repaint();
}
void setTextColor(QColor color) {
m_textColor = color;
repaint();
}
void setBackgroundColor(QColor backgroundColor);
protected:
virtual void paintEvent(QPaintEvent *);
private:
QString m_text;
QColor m_textColor;
QColor m_backgroundColor;
// 是否自动跟随主题
bool m_bAutoTheme;
};
#endif // CIRCLELABEL_H