Nominate our 2022 Qt Champions!

QPixmap Quality MacOS/Linux/Windows

  • Hello,

    I use the option


    In order to obtain the best possible pixmaps, especially when scaling images.

    Under MacOS the images look very good (48x48px scaled to 16x16px or 32x32px). In the screenshot below you can see it

    alt Under MacOS

    On Linux and Windows, they look very bad, as if they had dragged them with paintbrush.

    alt Under Linux

    Is there another option, which works as under MacOS?

    pstar = pstar.scaled(QSize(16,16),Qt::AspectRatioMode::KeepAspectRatio,Qt::SmoothTransformation);

    they looks under Linux better, but under MacOS bad :)

    They are drawn on QAbstractItemDelegate paint event by

    r = option.rect.adjusted (imageSpace, 0, 0, 0);
    r.setSize (Qsize (16,16));
    QPixmap pstar;
    pstar.load ( ":/smallimages/images32/star.png");
    Painter> drawPixmap (r, pstar);

  • Lifetime Qt Champion


    What size are your icons ?

  • @SGaist Currently 48x48px, tested with 64x64px with same results.

    pstar = pstar.scaled(QSize(16,16),Qt::AspectRatioMode::KeepAspectRatio,Qt::SmoothTransformation);

    helped under Windows and Linux. But is not very beautiful, blurr quality.

  • Lifetime Qt Champion

    And what is the image original size ?

  • @SGaist The original size are 48x48px
    With SmoothTransformation i get better results, only on MacOS the quality looks perfect.

Log in to reply