Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. High DPI and native presentation of images

High DPI and native presentation of images

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 536 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stvokr
    wrote on last edited by
    #1

    Hi all,

    I am using a 4K monitor with Qt High DPI. I am using the following attributes to get High DPI enabled.

    QApplication::setAttribute( Qt::AA_EnableHighDpiScaling );
    QApplication::setAttribute( Qt::AA_UseHighDpiPixmaps );
    

    On Windows I use 175% or 200% scaling and alignment. With these settings, my application can be displayed with a scaling factor of 2. Funny thing, even with 175% or 150% I get a scaling factor of 2, so I thing the scaling factor are integer numbers.
    I have some kind of an image viewer and the images should be displayed with 100% size, but Qt transformed these images also with the scaling factor. So the native images are displayed with 200%.

    Is there a way that Qt won't scale images that are painted in a paint event?
    Or how do I get the information about the current scaling factor that Windows is currently using?

    regards
    Oliver

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stvokr
      wrote on last edited by
      #2

      I found a solution myself.

      When drawing the image I can get the current screen and its device pixel ratio. This is the current scaling factor Windows is using.
      With this factor I can scale the image to the current size.

      regards
      Oliver

      1 Reply Last reply
      3

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved