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. Disable Qt DPI awareness

Disable Qt DPI awareness

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 6.3k Views 1 Watching
  • 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.
  • W Offline
    W Offline
    wjlrkjjv
    wrote on last edited by
    #1

    Hello,

    I'd like to change Qts behavior to render in fixed size (pixels) and be scaled up by the OS (Windows).
    Is it possible?

    Why? Because:
    I want to render some small icons inside a QListWidgetItem (via delegate) but I just don't know how to deal with high dpi.
    If I change the widget item sizeHint to 20 for example, it will be in pixels and on high dpi, text will be larger and outside the widget item which is 20 pixels in height.
    By what value do I have to multiply these 20 pixels? And how do I draw the icon so that it always fits the height?

    I'm just too confused... :(

    1 Reply Last reply
    0
    • W Offline
      W Offline
      wjlrkjjv
      wrote on last edited by
      #2

      QMainWindow::devicePixelRatio() always returns 1 (I changed windows dpi to 150%).
      Why is the return type int and not double?

      1 Reply Last reply
      0
      • W Offline
        W Offline
        wjlrkjjv
        wrote on last edited by
        #3

        Noone knows how to draw dpi aware or disable it and let windows scale?

        1 Reply Last reply
        0
        • timdayT Offline
          timdayT Offline
          timday
          wrote on last edited by
          #4

          I don't think QMainWindow::devicePixelRatio() does what you think it does. I'm not sure I know what it does either, but since it says "Common values are 1.0 on normal displays and 2.0 on Apple "retina" displays." I wouldn't worry about it until I was trying to understand some issues with some goofy HW like a retina display (which I believe can report some not-technically-correct numbers for resolution etc, for backwards compatibility reasons).

          What I think you should actually be looking at is:

          • Get hold of the screen your window is on with QWindow::screen()
          • Query physicalDotsPerInch or logicalDotsPerInch as appropriate for what you're doing (note there are X Y versions too!); see the Detailed Description section for more info what the difference is.
          1 Reply Last reply
          0
          • W Offline
            W Offline
            wjlrkjjv
            wrote on last edited by
            #5

            Thank you!

            Is it possible to tell Qt to draw in pixels and ignore the windows DPI setting?
            Even with a DPI manifest set to non-aware, Qt still scales and no scaling by windows occurs..

            1 Reply Last reply
            0
            • Q Offline
              Q Offline
              qtacc32
              wrote on last edited by qtacc32
              #6

              It's possible by setting the manifest to "None" and specifying "-platform windows:dpiawareness=0" as startup parameter.

              1 Reply Last reply
              0

              • Login

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