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. Ui wrong size when multiple dpi settings
QtWS25 Last Chance

Ui wrong size when multiple dpi settings

Scheduled Pinned Locked Moved Unsolved General and Desktop
multiple dpidpi awareness
7 Posts 2 Posters 3.4k 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.
  • fra87F Offline
    fra87F Offline
    fra87
    wrote on last edited by
    #1

    Hello
    I have a small problem. I have a multimonitor setup and Windows 8.1; the monitors are different in size, so the OS automatically changes the DPI scaling; particularly the main monitor is bigger (and so the scaling size is greater).
    Just to show you, this is an example of two explorer windows. They were spanning over the two monitors, so the OS resized them according to the DPI scaling of the monitor. Particularly the upper one was the one with the primary (bigger) monitor, the lower one with the second one.

    Now, problems arise when I create a new QT Widgets UI and try to display it on the two different monitors. I created a simple GUI with some controls and moved it on the two different monitors.

    I created it with and without horizontal layouts. You can see here an image showing the comparison of the different results.

    As you can see, the text becomes bigger on the second monitor, which is what you would expect since it should be displayed in a proper way. There is an exception, though: the textbox inner text is not scaled.

    The major problem, however, is that the widget size is not increased. Look at the widgets in the "without layout" row or at the tab names in both versions: you can clearly see that the labels are cropped at the end of the widget.

    Now, is there a fix for this? Is it a bug? Or it is simply the right behavior? I think that the text size should grow, but also the overall size should: the whole window should become bigger, otherwise these artifacts can show.

    1 Reply Last reply
    1
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Which version of Qt are you using ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      fra87F 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Which version of Qt are you using ?

        fra87F Offline
        fra87F Offline
        fra87
        wrote on last edited by
        #3

        @SGaist Thank you ;)
        I'm using Qt 5.7, with the MinGW compiler. I updated it recently (last week, I think).

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Do you have the same happening if you open your application directly on the second monitor ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          fra87F 1 Reply Last reply
          0
          • SGaistS SGaist

            Do you have the same happening if you open your application directly on the second monitor ?

            fra87F Offline
            fra87F Offline
            fra87
            wrote on last edited by
            #5

            @SGaist Yes, exactly the same. And I also have the same behavior if I launch the application directly from the exe file.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Did you already check the Windows part of the High DPI documentation ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • fra87F Offline
                fra87F Offline
                fra87
                wrote on last edited by
                #7

                Ok, did some tests and it seems that setting the windows:dpiawareness to 0 or 1 fixes the problem.

                But... The problem is, the form is much more readable with the scaling at 2, since it is almost the same size on both monitors. The problem is that while the font size increases, the local sizes don't. And so the labels are cropped.

                In my opinion, a much better scaling would be to increase also the linear sizes, so that the whole window has almost the same size on both monitors.

                I don't know if I could explain well my opinion...

                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