这个函数文档的意思就是画弧,看了文档也不太明白,自己做了demo终于明白了意思
移动到圆心,画180度半圆
void TestArcTo::paintEvent(QPaintEvent *) { QPoint startPt(30, 30); QRect rect(startPt.x(), startPt.y(), 200, 200); QPainter p(this); p.setRenderHint(QPainter::Antialiasing); //抗锯齿 p.fillRect(rect, QColor(255, 255, 255)); int arcR = rect.width()/2; int rectSize = rect.width(); QPainterPath path; path.moveTo(startPt.x() + arcR, startPt.y() + arcR); //先移动到圆心 p