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

QPushButton icon draw bug in Fusion high-dpi

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.12.1, 5.13.0 Alpha 1
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Windows 10 with a 4k and 1080p screen
    • Platform/s:
      Windows
    • Commits:
      81a790969395feff73fa600908822765e97424e5 (qt/qtbase/5.15)

      Description

      QPushbutton with an icon behaves incorrectly in a mixed-dpi environment.  In particular,

       

      QFusionStyle::drawControl draws the icon for CE_PushButtonLabel like:

      QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state);

       

      but QCommonStyle::drawControl does it like:

      QPixmap pixmap = button->icon.pixmap(qt_getWindow(widget), button->iconSize, mode, state);

       

      Because Fusion style is missing the QWindow* parameter to QIcon.pixmap() call, the global qApp->devicePixelRatio is always being applied, even on widgets / screens where this is not appropriate.   In my case, the QIcon draws correctly on a 4k screen but not on a secondary 1080p screen.

       

      I have attached 2 screenshots that demonstrate the issue.  I created a QIcon with pixmaps of both 90x90 and 30x30.  With style Fusion, QIcon:pixmap selects the 90x90 icon (which is not correct, and it's rendered jagged).  Without fusion style, the correct 30x30 pixmap is chosen.

        Attachments

        1. fusiondpi.PNG
          fusiondpi.PNG
          3 kB
        2. fusionoff.PNG
          fusionoff.PNG
          3 kB
        For Gerrit Dashboard: QTBUG-74100
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            sorvig Morten Sørvig
            Reporter:
            redcoat5 Mark de Wit
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes