Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-73587

QIcon::pixmap() double scaling when Qt::AA_UseHighDpiPixmaps set

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.15.0 Beta2
    • 5.11, 5.12
    • GUI: Painting
    • None
    • Linux/X11
    • d8ab719c0890195cfce0fb6d4c76b3664d6f3a9d (qt/qtbase/5.15)

    Description

      The test program below prints out
      QPixmap(QSize(64, 64),depth=32,devicePixelRatio=4,cacheKey=0x300000003)
      while one would have expected a 32x32, dpr=2 pixmap.

      #include <QApplication>
      #include <QIcon>
      #include <QPixmap>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
          // Just to control the environment; results are the same
          // if the scaling comes from the screen
          qunsetenv("QT_AUTO_SCREEN_SCALE_FACTOR");
          qunsetenv("QT_SCREEN_SCALE_FACTORS");
          QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
      
          qputenv("QT_SCALE_FACTOR", "2");
          QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
      
          QApplication app(argc, argv);
      
          QIcon ic = QIcon::fromTheme("edit-undo");  // A svg icon
          QPixmap pm = ic.pixmap(16);
          qDebug() << pm;
      
          return 0;
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              vestbo Tor Arne Vestbø
              vgt Eirik Aavitsland
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes