void QPainter::drawArc(const QRectF &rectangle, int startAngle, int spanAngle)
Qt助手是这样定义的。
Draws the arc defined by the given rectangle, startAngle and spanAngle.
绘制由给定矩形、startAngle和spanAngle定义的圆弧。
需要指出的是:给定的矩形是整个圆的矩形
The startAngle and spanAngle must be specified in 1/16th of a degree, i.e. a full circle equals 5760 (16 * 360). Positive values for the angles mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o’clock position.
startAngle和spanAngle必须以1/16度指定,即一个完整的圆等于5760(16 * 360)。角度的正值表示逆时针方向,负值表示顺时针方向。零度在3点钟方位。
需要指出的是:角度的正值表示逆时针方向,负值表示顺时针方向,不仅对于startAngle是适用的,对于spanAngle同样是适用的
QRectF rectangle(10.0, 20.0, 80.0, 60.0);
int startAngle = 30 * 16;
int spanAngle = 120 * 16;
QPainter painter(this);
painter.drawArc(rectangle, startAngle, spanAngle);
若
painter.drawArc(rectangle, startAngle, spanAngle); //(1)
改为
painter.drawArc(rectangle, startAngle, -spanAngle);//(2)
对于(1),从起始位置,沿逆时针方向绘制120度的圆弧;
对于(2),从起始位置,沿顺时针方向绘制120度的圆弧;