QT 画任意角度图形

QQ:609162385
在这里插入图片描述

方法解释,画任意角度原理是旋转了painter.rotate(210);坐标轴,绘图结束后将坐标轴还原即可painter.restore();

    QPainter painter(this);
    painter.save(); //保存原来坐标系统
    painter.translate(200, 300);
    painter.rotate(210); //坐标旋转degrees 度
    painter.drawRect (60,30,50,40);
    painter.drawEllipse (0,0,50,80);
    painter.drawEllipse (0,0,5,6);
    painter.restore(); //回复原来的坐标系统

猜你喜欢

转载自blog.csdn.net/cqltbe131421/article/details/83585149
QT