问:PaintEvent IOS像素化弧

时间:2015-04-06 07:14:32

标签: ios qt qpainter paintevent

所以我有一个Q::Painter画了一些圆圈。在Windows上,它完美地描绘了圆圈,但在iOS上它是像素化的:

enter image description here

这是非像素化图像:

enter image description here

如果有人可以帮我解决这个问题,我会非常感激的。代码完全相同,但iOS渲染不好......

这是我的代码:

void CQtPercentCircleWidget::paintEvent(QPaintEvent *pe)
{
    int circleX = parentWidget()->width()/2 - m_iCircleWidth/2;
    int circleY = m_iPenWidth;
    QRectF normalCircle(circleX, circleY, m_iCircleWidth, m_iCircleHeight);
    QPainter painter(this);
    painter.setRenderHints((QPainter::Antialiasing,QPainter::HighQualityAntialiasing), QPainter::SmoothPixmapTransform);
    painter.setPen(m_qpenNormalColor);
    painter.drawEllipse(normalCircle);
    QRectF activeCircle(circleX, circleY, m_iCircleWidth, m_iCircleHeight);
    int startAngle = 90 * 16;
    double dProgress = (double)m_iProgressPercent;
    int currentAngle = (dProgress / 100) * (360 * 16);
    painter.setPen(m_qpenCurrectPenColor);
    painter.drawArc(activeCircle, startAngle, currentAngle);

} 

1 个答案:

答案 0 :(得分:0)

您使用setRenderHints()错误。将其更改为:

   painter.setRenderHints(QPainter::Antialiasing | QPainter::HighQualityAntialiasing | QPainter::SmoothPixmapTransform);