yhkylin-backup-tools/kybackup/component/linelabel.cpp

24 lines
567 B
C++
Raw Normal View History

2021-10-13 16:31:58 +08:00
#include "linelabel.h"
#include <QPainter>
LineLabel::LineLabel(QWidget* parent /*= nullptr*/, QColor color /*= QColor(0xCC, 0xCC, 0xCC)*/, QSize size /*= QSize(150, 24)*/) :
QLabel(parent),
m_color(color)
{
setFixedSize(size);
}
LineLabel::~LineLabel()
{}
void LineLabel::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.setPen(m_color);
QRect rect = this->rect();
painter.drawLine(0, rect.height()/2, rect.width(), rect.height()/2);
QLabel::paintEvent(event);
}