Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QPixmap Quality MacOS/Linux/Windows

    General and Desktop
    2
    5
    862
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      roundcubes last edited by

      Hello,

      I use the option

      qApp->setAttribute(Qt::AA_UseHighDpiPixmaps);
      

      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?
      With

      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);
      
      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        What size are your icons ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        R 1 Reply Last reply Reply Quote 2
        • R
          roundcubes @SGaist last edited by

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

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

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

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            And what is the image original size ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            R 1 Reply Last reply Reply Quote 0
            • R
              roundcubes @SGaist last edited by

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

              1 Reply Last reply Reply Quote 0
              • First post
                Last post