void PSV_CircularIndicatorItem::drawCoverBall(int zValue)
{
    qreal ballRadius=m_outerRadius * m_coverBallRadiusRatio;
    QRadialGradient ballGradient(m_rect.center(), ballRadius, m_rect.center());
    ballGradient.setColorAt(0.0, QColor(140, 140, 140));
    ballGradient.setColorAt(0.7, QColor(140, 140, 140));
    ballGradient.setColorAt(1.0, QColor(60, 60, 60));
    //==================
    QRectF rect(m_rect.center().x()-ballRadius, m_rect.center().y()-ballRadius, ballRadius*2, ballRadius*2);
    QGraphicsEllipseItem* item = new QGraphicsEllipseItem(rect, this);
    item->setPen(QPen(Qt::NoPen));
    item->setBrush(ballGradient);
    item->setZValue(zValue);
}
Пример #2
0
void myGauge2::drawCoverBall(QPainter *painter)
{
    painter->save();

    qreal ballRadius=m_outerRadius/7;
    m_coverBallRadius=ballRadius;
    QRadialGradient ballGradient(m_center,ballRadius,m_center);
    ballGradient.setColorAt(0.0,QColor(140,140,140));
    ballGradient.setColorAt(0.7,QColor(140,140,140));
    ballGradient.setColorAt(1.0,QColor(60,60,60));
    painter->setBrush(ballGradient);
    painter->setPen(Qt::NoPen);
    painter->drawEllipse(m_center,ballRadius,ballRadius);

    painter->restore();
}