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

HiDPI Scaling is bugged because it mostly depends on QGuiApplication primaryScreen



    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.0
    • Fix Version/s: None
    • Component/s: GUI: High-DPI
    • Labels:
    • Environment:
      2k Monitor + 1k Monitor.
    • Platform/s:


      Setup to reproduce:

      1. Get two monitors preferable one 4k and one 1k, but 2k and 1k (even 1k and 1k) should work too.

      2. Use widely different DPI Scaling for both monitors, eg. 200% and 100%

      3. Create an application with HiDPI support and add labels and icons and textboxes to the QMainWidget

      4. Compile and start the app.

      5. Move the Widget from one monitor to the other


      Depending WHICH monitor is the primary screen in windows there are two outcomes:

      200% scaling is PS: the text is not readable anymore on the 100% screen.

      100% scaling is PS: The text is too large on the 200% screen. (I assume this is the correct behaviour, since all labels even from windows are that large)


      Expected behaviour: I would expect that the DPI Scaling is independent from the primary screen. So that it is irrelevant which screen is set to the primary screen and. Both settings will produce the same result.
      Since QGuiApllication::primaryScreen() is used by the tutorial https://doc.qt.io/qt-5/scalability.html#calculating-scaling-ratio I think this might be the problem.

      I propose to eather let primaryScreen return the actual/current screen where the window is running on.

      Or add a function QGuiApllication::currentScreen() and update the above tutorial.

      Also let the Labels use the actual/current screen where the Window is displayed on.


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            sorvig Morten Sørvig
            febbe Fabian Keßler
            0 Vote for this issue
            2 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes