| 66 | } |
| 67 | |
| 68 | void ProgressWidget::paintEvent(QPaintEvent *) |
| 69 | { |
| 70 | QPainter painter(this); |
| 71 | painter.setRenderHint(QPainter::Antialiasing); |
| 72 | |
| 73 | painter.fillRect(rect(), m_backgroundColor); |
| 74 | |
| 75 | if (!m_isHovered) { |
| 76 | if (!m_logoPixmap.isNull()) { |
| 77 | QRect logoRect( |
| 78 | (width() - m_logoPixmap.width()) / 2, |
| 79 | 5, |
| 80 | m_logoPixmap.width(), |
| 81 | m_logoPixmap.height()); |
| 82 | painter.drawPixmap(logoRect, m_logoPixmap); |
| 83 | } |
| 84 | |
| 85 | int dotSpacing = 6; |
| 86 | int dotSize = 4; |
| 87 | int totalDotWidth = 3 * dotSize + 2 * dotSpacing; |
| 88 | int startX = (width() - totalDotWidth) / 2; |
| 89 | int dotY = height() - 8; |
| 90 | |
| 91 | for (int i = 0; i < 3; ++i) { |
| 92 | QColor dotColor = m_textColor; |
| 93 | |
| 94 | if (m_dotPosition == 0) { |
| 95 | dotColor.setAlpha(128); |
| 96 | } else { |
| 97 | if (i == m_dotPosition - 1) { |
| 98 | dotColor.setAlpha(255); |
| 99 | } else { |
| 100 | dotColor.setAlpha(80); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | painter.setPen(Qt::NoPen); |
| 105 | painter.setBrush(dotColor); |
| 106 | |
| 107 | int x = startX + i * (dotSize + dotSpacing); |
| 108 | painter.drawEllipse(x, dotY, dotSize, dotSize); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | if (m_isHovered) { |
| 113 | int closeSize = 14; |
| 114 | int centerX = width() / 2; |
| 115 | int centerY = height() / 2; |
| 116 | |
| 117 | QPen closePen(m_textColor, 2); |
| 118 | closePen.setCapStyle(Qt::RoundCap); |
| 119 | painter.setPen(closePen); |
| 120 | |
| 121 | int offset = closeSize / 2; |
| 122 | painter.drawLine(centerX - offset, centerY - offset, centerX + offset, centerY + offset); |
| 123 | painter.drawLine(centerX + offset, centerY - offset, centerX - offset, centerY + offset); |
| 124 | } |
| 125 | } |
nothing calls this directly
no outgoing calls
no test coverage detected