I'm learning QT, and had a quick question:
What would be the best way to draw a circle with radius r with the center point at x,y?
Thanks!
解决方案
In a paintEvent use this:
In a QGraphicsView/QGraphicsScene use this:
The last link listed, is an overloaded method that allows you to enter the center point with the two radii specified.
void QPainter::drawEllipse ( const QPointF & center, qreal rx, qreal ry )
So your code would look something like:
// inside MyWidget::paintEvent()
painter.drawEllipse(QPointF(x,y), radius, radius);
Hope that helps.