11 IconLabel(
const QString& name,
const QColor& headerColor,
const QColor& bgColor)
13 QPixmap pix(_width, _height);
14 pix.fill(Qt::transparent);
15 QPainter painter(&pix);
17 painter.setPen(Qt::NoPen);
19 painter.setRenderHint(QPainter::Antialiasing);
21 painter.setBrush(QBrush(bgColor));
22 QRectF boundary(0, 0, pix.width(), pix.height());
23 painter.drawRoundedRect(boundary, _radius, _radius);
24 painter.setBrush(QBrush(headerColor));
26 QRectF boundary2(0, 0, pix.width(), _labelHeight);
27 painter.drawRoundedRect(boundary2, _radius, _radius);
29 QRectF boundary3(0, _labelHeight / 2, pix.width(), _labelHeight / 2);
30 painter.drawRect(boundary3);
32 painter.setPen({ Qt::white, 1 });
33 QFont font({
"Arial", 8 });
35 painter.setFont(font);
36 painter.drawText(6, 15, name);
38 setMinimumSize(_width, _height);
39 setMaximumSize(_width, _height);
43 setProperty(
"type",
"IconLabel");