Results 1 to 5 of 5

Thread: Question about screen resolution, dpi and font size

  1. #1
    Join Date
    Nov 2014
    Posts
    35
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Question about screen resolution, dpi and font size

    Hello,

    I am developing an application using Qt 5.3, and I have created most of the widgets using Qt Designer, which means, all widgets were designed with pixel accuracy.

    All is fine and good in regular monitors, however, I have received a report from a user who has a high display monitor (2560x1440), in which the fonts are super large and all the layouts and buttons are pushed beyond their designed areas.

    This is a screen shot of how the application looks in my 1920x1080 monitor:

    http://i.imgur.com/DQpDcMi.png

    And here is how it looks in a the 2560x1440 monitor:

    http://i.imgur.com/H2EQPqv.jpg

    My questions are:

    - Why are the fonts so large? Is there a way to tell Qt to ignore the high dpi and use the fonts shown normally at 96 dpi?

    - Is there a way to simulate this issue in my PC so that I can properly test and fix it?

    - Is it possible to design the widgets in Qt Designer using a font size relative value?

    Thank you!
    pixaeiro
    http://www.pixaflux.com
    Non-destructive Image Editor

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,229
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Question about screen resolution, dpi and font size

    Your image links don't work in Firefox. Why didn't you simply upload the images to the forum? There's even an "Insert Image" icon to do that...

    However, I think I know what you mean. I use a 4K monitor (3840 x 2160). Normal Windows fonts are too small for me to read easily, so I used Windows "Customize your display" settings to increase the font size to 125% of normal. I noticed that some of my Qt apps did not react to this change properly, possibly those running with Qt 5.4, and especially those where I had designed GUI elements with fixed maximum sizes.

    Ask your user if that is what he has done. You can simulate it (in Windows, anyway) using Settings->Display and increasing the text size. My fix was to either remove the size restrictions on labels, pushbuttons, etc. or to increase them so the text would fit when viewed on my screen. With any new GUIs, I use layouts wherever possible, and give them room to grow if necessary by adding horizontal or vertical stretch elements. In Qt 5.5 at least, I haven't noticed any further problems.

  3. The following user says thank you to d_stranz for this useful post:

    pixaeiro (13th April 2016)

  4. #3
    Join Date
    Nov 2014
    Posts
    35
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question about screen resolution, dpi and font size

    Thanks d_stranz.

    I didn't upload the images to the forum because it didn't allow me, I got a message saying the image was too large. I am testing in a different computer with Firefox and the links open an imgur page with the image, maybe you are blocking imgur in your Firefox.

    I have done tests with Customize your dispaly and the Change the size of text, apps, and other items slider, and this setting scales the whole screen, and the scale is uniform, not just the fonts (like if you were resizing in Photoshop). My application has a ruler and some other items that I can measure in the screenshots, and they are the same size in both the 2560x1440 and 1920x1080 screenshots.

    Is there a way in Qt to force it to use the same font everywhere?

    Thank you!
    pixaeiro
    http://www.pixaflux.com
    Non-destructive Image Editor

  5. #4
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    120
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Question about screen resolution, dpi and font size

    Hello,

    I had the same problem using a 4k monitor and Qt 5.5 under Windows 10. As a temporary workaround I installed a file qt.conf into the application binary folder with following content:
    Qt Code:
    1. [Platforms]
    2. WindowsArguments = dpiawareness=0
    To copy to clipboard, switch view to plain text mode 
    With this setting Windows scales the whole application (fonts + graphics). Drawback of this approach: the fonts do not look as crisp as possible, but it is acceptable for scalings of 125-150%.

    Qt 5.6 should provide better dpi awareness. I tried it a few months ago with a Qt 5.6 beta version and without installing the qt.conf file. The result was better than with version 5.5, but still not perfect. Hopefully it has improved for the released version, but I have not checked it up to now.

    Best regards
    ars

  6. The following 2 users say thank you to ars for this useful post:

    d_stranz (14th April 2016), pixaeiro (13th April 2016)

  7. #5
    Join Date
    Nov 2014
    Posts
    35
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question about screen resolution, dpi and font size

    Thank you ars.
    I have asked the user to test this solution, I'll post here his response.
    pixaeiro
    http://www.pixaflux.com
    Non-destructive Image Editor

Similar Threads

  1. Qt Creator Welcome screen and help screen font size
    By zd3nik in forum Qt Tools
    Replies: 0
    Last Post: 23rd November 2013, 18:57
  2. Font size according to the resolution
    By pssss in forum Qt Programming
    Replies: 0
    Last Post: 2nd September 2011, 11:07
  3. Windows Mobile VGA Screen font size problem
    By LordG in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 25th November 2010, 10:13
  4. Replies: 8
    Last Post: 20th June 2010, 20:15
  5. Replies: 1
    Last Post: 27th March 2008, 16:10

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.