Improve support of high DPI displays

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Improve support of high DPI displays

Post by wmayer »

There is an interesting Qt blog about support of high DPI displays: https://blog.qt.io/blog/2016/01/26/high ... in-qt-5-6/
An interesting fact is that it can be tested on any hardware, i.e. also on low resolution displays. All what must be set is the environment QT_SCALE_FACTOR=1.5 (or any other value) before starting the application.

This way I could reproduce the issue issue #0003130 where the rubberband has an offset.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Improve support of high DPI displays

Post by sgrogan »

looo wrote: Thu Mar 14, 2019 9:19 pm I guess the high resolution difficulties are general mac problems. So not something specific to the conda-packages. Anyway it would be nice to fix them.
I see some commits to master from wmayer.https://github.com/FreeCAD/FreeCAD/commits/master
@looo are you able to provide a build for this? Great work. When you are ready I would like to uplaod an OSX build to the releases page as a release candidate, let me know when you are ready.
"fight the good fight"
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Improve support of high DPI displays

Post by wmayer »

looo wrote: Sat Mar 16, 2019 9:06 am Maybe doing a 0.18.1 release with some backports?
Since we split the 0.18 branch I have pushed a couple of commits to the master branch. Some of them can be backported to v0.18:
git commit a14b99e77
git commit 2f2d50535
git commit bb6e4e6ad
git commit 23ecb8eac
git commit ca7770b80
git commit 51fcdd2c0
git commit 805ccd8deb
git commit 347156403
git commit 094dda5900d
git commit 925cffc1535
git commit 7dfeb801a
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Improve support of high DPI displays

Post by uwestoehr »

I tested a FC 0.19 build on a hi-DPI laptop and it seems that FC does not recognize that it runs on a Hi-DPI PC. The About dialog is so big it even blocks the usage of FC: https://forum.freecadweb.org/viewtopic.php?f=10&t=56425

But I see that also on a fresh installation the toolbars are huge, as well as the text in the Start WB, the images in the preferences dialog sidebar are pixelated etc.
Do I have to set a special build option in CMake to get it right?
User avatar
chennes
Veteran
Posts: 3883
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Improve support of high DPI displays

Post by chennes »

I'm not sure what's going on in your case there, @uwestoehr -- I run almost exclusively on HiDPI displays and while there are certainly issues, in order to duplicate your results I had to turn off FreeCAD's internal scaling by telling Windows to do the scaling itself. Nevertheless, it may be a moot point going forward since we can now guarantee that users of 0.20 have at least Qt 5.9, so many of Qt's HiDPI facilities are now available to us. I hope to spend some time on that project during the 0.20 dev cycle.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
vanuan
Posts: 539
Joined: Wed Oct 24, 2018 9:49 pm

Re: Improve support of high DPI displays

Post by vanuan »

To my knowledge, there's no CMake option.

The only condition we have is a fresh Qt version. Have you upgraded your Qt version recently?

Maybe you have a large font size set in your FreeCAD settings?
Or some plugin that scales all text sizes up or down.

In older Qt version there's an option of setting environment variable QT_SCALE_FACTOR. Maybe you have it set to a large value?
That was required for old Qt versions, but not anymore.
https://doc.qt.io/qt-5/highdpi.html
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Improve support of high DPI displays

Post by uwestoehr »

vanuan wrote: Mon Mar 08, 2021 7:43 am The only condition we have is a fresh Qt version. Have you upgraded your Qt version recently?
I use the Qt of the LibPack 12.5.1:

OS: Windows 10 Version 2009
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24272 (Git)
Build type: Release
Branch: releases/FreeCAD-0-19
Hash: 27b568e4e474f8b020203a7190b4db2afe5c8cc5
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: German/Germany (de_DE)
vanuan wrote: Mon Mar 08, 2021 7:43 am Maybe you have a large font size set in your FreeCAD settings?
Or some plugin that scales all text sizes up or down.
I carefully checked that there were no traces of former FC versions. I also cleaned the registry from all FC-related entries.
Then I installed FC 0.19 so I get the default settings and with them FC looks horrible. Here are two examples:
DZkF8OR0hc.png
DZkF8OR0hc.png (232.22 KiB) Viewed 4809 times
48OSPcZfUw.png
48OSPcZfUw.png (194.88 KiB) Viewed 4809 times

So everything is huge.

But all other apps ion this PC scale nicely. For example here is a screenshot of LibreOffice:
nXqxXWX15O.png
nXqxXWX15O.png (135.74 KiB) Viewed 4809 times
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Improve support of high DPI displays

Post by uwestoehr »

For the records: here are screenshots from another Laptop that has a 13.3'' inch display (the one with smallest screen I could find). And here FC 0.19 looks fine (screen resolution 1366 x 768):
TAM7xql1yk.png
TAM7xql1yk.png (99.62 KiB) Viewed 4759 times
2Ro2Llm556.png
2Ro2Llm556.png (106.84 KiB) Viewed 4759 times
BIM Bo
Posts: 40
Joined: Sun Nov 22, 2020 3:55 pm

Re: Improve support of high DPI displays

Post by BIM Bo »

vanuan wrote: Mon Mar 08, 2021 7:43 am In older Qt version there's an option of setting environment variable QT_SCALE_FACTOR. Maybe you have it set to a large value?
That was required for old Qt versions, but not anymore.
https://doc.qt.io/qt-5/highdpi.html
Says who? The Qt or the FreeCAD marketing department?

4k 15.6" HiDPI Screen here. Starting the AppImage with no Qt sauce results in humongous "many things" - as in menu fonts etc. Much like uwe has shown and much according to my own experience in the past.

Starting the appImg with

Code: Select all

QT_SCALE_FACTOR=0.7 ./FreeCAD_weekly-builds-24693-Linux-Conda_glibc2.12-x86_64.AppImage
results in an uninterruptible 100% CPU hang of this process

Code: Select all

642652 112252  84004 R 100.0   0.7   0:45.94 /tmp/.mount_FreeCAFqyEg7/usr/bin/freecad
:shrug:

Code: Select all

^C^Z
[1]+  Stopped                 QT_SCALE_FACTOR=0.7 ./FreeCAD_weekly-builds-24693-Linux-Conda_glibc2.12-x86_64.AppImage
$ kill -9 %1
[1]+  Killed                  QT_SCALE_FACTOR=0.7 ./FreeCAD_weekly-builds-24693-Linux-Conda_glibc2.12-x86_64.AppImage
Uninterruptible as in Ctrl+C ignoring. Ctrl+Z and the kill works.

edit:

In fact, any scale factor != 1 will result in the hang. A scale factor of 1 will not, but is - obviously - useless.
QT_AUTO_SCREEN_SCALE_FACTOR=1 will also not result in a hang (hooray!), but does not change the frankenstein behavior.
(head too big, hands too small, ...)
User avatar
vanuan
Posts: 539
Joined: Wed Oct 24, 2018 9:49 pm

Re: Improve support of high DPI displays

Post by vanuan »

BIM Bo wrote: Fri Apr 16, 2021 9:33 am
Please change your tone. I understand your annoyance. But it doesn't help.

It would be much more productive if you could describe the issue carefully, specify your scale factor in display settings and screenshots of how it looks compared to other GNOME apps. Also you didn't provide Qt version to make any claim on whether any environment variables required.
Post Reply