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

QDesktopWidget::devicePixelRatioF() reports wrong ratio on Plasma Wayland

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 5.12.7, 5.15.1
    • QPA: Wayland

    Description

      OS: OpenSUSE Leap 15.2
      DE: KDE Plasma 5.18.5 - Full Wayland

      I have set my Screen Scaling to 150% as seen on the attached screenshot. In my application following code reports device pixel ratio of 2, expected would 1.5:

      auto desktopWidget = QApplication::desktop();
      return desktopWidget->devicePixelRatioF();    // returns 2, expected 1.5

      Also, tested on Arch Linux running Sway Wayland and screen scaling set to 250%, following is reported:

      DesktopWidget devicePixelRatio: 3
      DesktopWidget devicePixelRatioF: 3
      DesktopWidget logicalDpiX: 96
      DesktopWidget logicalDpiY: 96
      DesktopWidget physicalDpiX: 135
      DesktopWidget physicalDpiY: 135
      QScreen devicePixelRatio: 3
      QScreen logicalDotsPerInch: 96
      QScreen logicalDotsPerInchX: 96
      QScreen logicalDotsPerInchY: 96
      QScreen physicalDotsPerInch: 135
      QScreen physicalDotsPerInchX: 134.532
      QScreen physicalDotsPerInchY: 135.467
      QWindow devicePixelRatio: 3
      

       

      Attachments

        Activity

          People

            qt.team.graphics.and.multimedia Qt Graphics Team
            dporobic Damir Porobic
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: