我正在学习QT,有一个快速问题:
如何以x,y为圆心,半径为r绘制一个圆?
谢谢!
paintEvent
中使用这个:
http://doc.qt.io/qt-4.8/qpainter.html#drawEllipse
http://doc.qt.io/qt-4.8/qgraphicsscene.html#addEllipse
在QGraphicsView
/QGraphicsScene
中使用以下代码:
http://doc.qt.io/qt-4.8/qgraphicsellipseitem.html
http://doc.qt.io/qt-4.8/qpainter.html#drawEllipse
最后一个链接列出了一个过载的方法,允许您使用指定的两个半径输入中心点。// inside MyWidget::paintEvent()
painter.drawEllipse(QPointF(x,y), radius, radius);