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

QPushButton icon draw bug in Fusion high-dpi

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.12.1, 5.13.0 Alpha 1
    • None
    • Windows 10 with a 4k and 1080p screen
    • Windows
    • 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
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes