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

Provide a convenience function for obtaining a screen's physical pixel resolution

    XMLWordPrintable

Details

    Description

      QScreen::geometry() and QScreen::size() return a scaled screen size, as documented at https://doc.qt.io/qt-6/highdpi.html#device-independent-screen-geometry

      You can get the unscaled resolution by multiplying the reported size by the device pixel ratio:

      auto scr = app.primaryScreen();
      qDebug() << scr->size() * scr->devicePixelRatio();
      

       

      Suggestion

      Provide a convenience function to return the unscaled resolution (QScreen::unscaledSize() ?)

      Attachments

        Activity

          People

            sorvig Morten Sørvig
            skoh-qt Sze Howe Koh
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: