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. Working with high DPI
Forum Updated to NodeBB v4.3 + New Features

Working with high DPI

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 106 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
    sapvi
    wrote last edited by
    #1

    Hi all. Even after reading docs on the topic, I do not understand at all how to work with higher DPI. From the docs, I am assuming that the higher-DPI adaptation should happen automatically. But what it creates is just a mess of a GUI. The elements that fit the height of the window stop fitting as soon as I change from 100% to 300% or even 200% scale setting in Win11.

    Honestly, I do not even know what to google, I seem to find no information on how to deal with it and how to have interface that reasonably adapts to the DPI change without setting height/width of all elements manually for different DPI values. Are there any resources that you would recommend me to read, apart from the official docs? Why, if GUI looks ok at 100% Scale, it does not look ok at 200% Scale, if the docs claims that in Qt6 the adaptation to DPI should be automatically performed?

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      zvoopz
      wrote last edited by
      #2

      What type of GUI do you use? QWidget or QML?
      Can you show examples when elements stop fitting the window?

      1 Reply Last reply
      1
      • I Offline
        I Offline
        IgKh
        wrote last edited by
        #3

        To give a general answer: the documentation is correct; Qt does handle HiDPI scaling automatically, in the sense that it will ensure that for anything drawn by it each logical pixel measure specified by the application will actually be expanded to the appropriate number of physical pixels according to the display ratio. So if your applications paints a 10x10 rectangle, and DPI scaling is 300%, Qt will draw a 30x30 rectangle.

        Note however two things: the first is that Qt cannot do this for things it doe not paint (like the application window frame). The second is that physical pixels are limited by the display resolution, and can't be just conjured out of the air. This means that a each individual element in your UI grows, less of them can fit in the screen.

        If your application UI is generally responsive - by properly using layouts (in widgets) and anchors (in QML) - this helps, but only to a degree. In very high scaling factors you'll hit minimum size hints and the like. If you need to support that, then yes - you'll need a different version of the UI optimized for very low resolution, or accommodating by wrapping things in scroll areas or custom layouts that can reflow into multiple lines, etc.

        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