Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QGraphicsPixmapItem quality degraded when rotated



  • Does anyone know why a quality of a QGraphicsPixmapItem degrades after rotating it?

    This is the original image:
    95fcfb8c-8724-4ea8-8e74-5e416a32a58d-image.png

    This one is rotated by just 1°:
    1276291e-018b-495f-90d1-d8c509802158-image.png

    So far I have tried setting the TransformationMode:

    setTransformationMode(Qt::SmoothTransformation);
    

    And painting it manually:

    painter->setRenderHints( QPainter::Antialiasing | QPainter::SmoothPixmapTransform );
    painter->drawPixmap( boundingRect().topLeft(), myOriginalPixmap );
    

    Without any noticeably change there.

    This is how the rotation is done:

    auto center = boundingRect().center();
    auto transform = this->transform();
    transform.translate(center.x(), center.y());
    transform.rotate(angel);
    transform.translate(-center.x(), -center.y());
    setTransform(transform);
    

    I have also tried rotating with this, but the effect was the same:

    setRotation(angel);
    

    What I have noticed is that rotating by 90°, 180°, 270° and 360° looks ok.
    Any Ideas how to fix this?


Log in to reply