Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt/QML 5.15.5 How to set logical DPI to 96
Forum Updated to NodeBB v4.3 + New Features

Qt/QML 5.15.5 How to set logical DPI to 96

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 727 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.
  • V Offline
    V Offline
    VFCraig
    wrote on last edited by VFCraig
    #1

    On my system, Windows 10, I have a logical DPI of 96 and a physical of 141.???. I am developing for a Linux embedded device with a 133 physical DPI. The logical is also 133. This is problematic as our font settings/all our text is showing up way too big on the target.

    How can we set the logical DPI?

    Also, we are using boot2qt, the configuration of which is not something I have access to, but if a setting is required in there to insure that a virtual screen representation will be used for Qt applications, so be it. Or if I can append an environment variable setting to the launch command to set it appropriately, that would work.

    Reminder, we are using Qt/QML 5.15.5. And, yes, I am aware that 6 does seem to have better features to do this.

    Thanks in advance for any help.

    1 Reply Last reply
    0
    • V Offline
      V Offline
      VFCraig
      wrote on last edited by
      #2

      It would appear to be that there is an environment variable that will do this, not perfectly, but certainly vastly better than previously. Sadly, the very limited documentation on it implies it is only something for development purposes, presenting a clumsy way to look at your app using different DPI settings.

      The following, placed in main.cpp, worked. Yes, it could be set in the environment as well, having first tested it as a .profile entry.

          qputenv("QT_FONT_DPI", QByteArray("96"));
      

      96 DPI is just a reference value on which Qt should be doing the appropriate scaling internally. It could be almost anything and still achieve the same results. Virtual pixels are obviously used for GUI components, why not consistently for the fonts.

      Though we are seeing what appears like a font substitution as well. Best guess is that Arial is being substituted for Liberation Sans, even though Liberation Sans is installed on all systems and is specifically loaded by the application. For example, the zero is much narrower on my system than on the target, as is the case of the zero in Arial as opposed to Liberation Sans.

      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