Qt drawing a ring / circle with a hole

Viewed 3620

I need to draw a circle with QPainter. When I used drawEllipse function like :

void UserClass::Draw(QPainter &painter) {

    painter.save();
    painter.setBrush( GetColor() );
    QPoint centerPosition = GetCenterPosition();
    painter.drawEllipse( centerPosition, m_CircleOuterRadius, m_CircleOuterRadius);
    painter.setBrush(QColor(0, 0, 0, 0));
    painter.drawEllipse( centerPosition, m_CircleInnerRadius, m_CircleInnerRadius);
    painter.restore();  
}

Unfortunately result is not what I desired. I want to have inner circle not be filled. That is why I put alpha value as zero but ofcourse it didn't work. How can I have a circle which is not until a certain radius with qt ?

enter image description here

1 Answers
Related