The startangle value of drawArc is slightly off center.
Solved
General and Desktop
-
void CustomIndicator::drawProgress(QPainter* painter) { painter->save(); { QPoint center = this->rect().center(); QRect drawingRect( center.x() - m_nOffsetCenter, center.y() - m_nOffsetCenter, this->size().height() * 60 / 100, this->size().height() * 60 / 100); QBrush brushBackgnd(m_ClrAnm); if (m_eStatus == CustomIndicator::INDICATOR_STATUS::ING) { brushBackgnd.setColor(m_ClrProgress); if (!m_pTimer->isActive()) brushBackgnd.setColor(m_ClrBackground); } else brushBackgnd.setColor(m_ClrProgress); QPen pen(QBrush(brushBackgnd), m_nThinkness); painter->setPen(pen); painter->setBrush(brushBackgnd); int nAngle = m_eStatus == CustomIndicator::INDICATOR_STATUS::ING || m_eStatus == CustomIndicator::INDICATOR_STATUS::STOP ? -45 * 16 : 360 * 16; if (m_eStatus == CustomIndicator::INDICATOR_STATUS::GENERAL) painter->drawArc(drawingRect, 90 * 16, m_rCurAngle * 16); else painter->drawArc(drawingRect, (m_rCurAngle--) * 16, nAngle); } painter->restore(); }
I set the startangle to 90 degrees and ran it.
The starting position is not in the center and there is some offset
What is wrong?