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

QIcon not using Hi DPI pixmap version

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.0.1, 6.1.0 Alpha
    • 6.0.0
    • GUI: Painting
    • None
    • b69b04c4790f319104a1098147cea9405b6e7062 (qt/qtbase/dev) b61275ee72ae2a895dee3652aca886859962cdb2 (qt/qtbase/6.0)

    Description

      On my Linux/Wayland (reproduces on Windows 10 as well) with DPI scaling set to 200%, QIcon does not automatically use the `@2x` Hi DPI pixmaps.

      I have created a simple reproducer to demo the issue. It contains a QListView widget in icon mode with an icon size of 64x64. Attached to the widget is a simple model with the following  `data()` method:

      QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override {
          if (role == Qt::DisplayRole) return "Hi-dpi repro";
          if (role == Qt::DecorationRole) return QIcon(":/icon64.png");
          return {};
      };

      In the resources there are two icons: `icon64.png` which is 64x64 pixels and `icon64@2x.png` which is 128x128 pixels.

      I would expect the 128x128 version to be used. Actually the 64x64 version in shown, resulting in poor image quality.

      When porting the attached reproducer to Qt5 and enabling `AA_UseHighDpiPixmaps`, the issue disappears. So it seems to me this is a Qt6 regression.

      Attachments

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

        Activity

          People

            vgt Eirik Aavitsland
            bbouclet Bastien Bouclet
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes