Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.1.0 GUI is overscaled on 4k displays (Win 11) #469

Open
iwbnwif opened this issue Jan 19, 2024 · 12 comments
Open

2.1.0 GUI is overscaled on 4k displays (Win 11) #469

iwbnwif opened this issue Jan 19, 2024 · 12 comments

Comments

@iwbnwif
Copy link
Contributor

iwbnwif commented Jan 19, 2024

All elements of the Qucs-S GUI are too big when using Windows 11 display scaling.

This is a new issue in 2.1.0 and didn't occur in 2.0.0.

It looks as though the scaling factor is being applied twice. I have the scale set to 150% and everything is approximately 1.5 times bigger than it should be (i.e., compared to 2.0.0 or other Qucs's.

It is possible to work around the problem by creating the following VBS script:

Dim WshShell, WshEnv
Set WshShell = CreateObject("WScript.Shell")
Set WshEnv = WshShell.Environment("PROCESS")
WshEnv.Item("QT_SCALE_FACTOR") = "0.67"
WshShell.Run "qucs-s.exe

The GUI size is fine in Ubuntu on the same hardware and with the same desktop scaling.

@ra3xdh
Copy link
Owner

ra3xdh commented Jan 20, 2024

Thanks for reporting and providing a workaround. I have never observed scaling issues with fullHD hardware using Linux or Windows platform. Unfortunately I have no access to 4k hardware to test what happens. Probably some scaling options should be applied as the QApplication attribute. The best way if someone will provide a patch fixing this issue.

@zergud
Copy link
Collaborator

zergud commented Jan 22, 2024

this is quite a complex problem and relates to non-integer scale factors (such as 150%)
we have different behavior for qt5 and qt6

if set Qt::HighDpiScaleFactorRoundingPolicy::Floor in version 2.1 we obtain correct GUI scaling (menu toolbar)
but wrong font scaling in schematic (problem exists in earlier versions as well)

need futher investigation!

image

@iwbnwif
Copy link
Contributor Author

iwbnwif commented Jan 23, 2024

I notice that the Windows binary ('portable package') for 2.1.0 is built using Qt5. I am not able to build on Windows at the moment, but would be happy to test a Qt6 version if there is a binary available.

wawuwo added a commit to wawuwo/qucs_s that referenced this issue Feb 9, 2024
Viewpainter measured font size in points, while sizes of line,
circles, etc. were measured in pixels. This made them scale differently
on HiDPI screens: 100 pixels is 100 pixel on any display, but 11pt
is equal to different number of pixels on standard and HiDPI screens.

This patch makes font size to be measured in pixels too.
See: ra3xdh#469
See: github.com/ra3xdh/issues/469#issuecomment-1903477584
wawuwo added a commit to wawuwo/qucs_s that referenced this issue Feb 9, 2024
Viewpainter measured font size in points, while sizes of line,
circles, etc. were measured in pixels. This made them scale differently
on HiDPI screens: 100 pixels is 100 pixel on any display, but 11pt
is equal to different number of pixels on standard and HiDPI screens.

This patch makes font size to be measured in pixels too.
See: ra3xdh#469
See: github.com/ra3xdh/issues/469#issuecomment-1903477584
@zergud zergud added this to the 24.2.0 milestone Feb 15, 2024
@wawuwo
Copy link
Contributor

wawuwo commented Feb 28, 2024

This ticket has been silent lately… Is GUI still overscaled on 4k in 24.1.0?

@iwbnwif
Copy link
Contributor Author

iwbnwif commented Feb 28, 2024

Yes, the binary available from the main site still has the overscaling problem.

@zergud
Copy link
Collaborator

zergud commented Feb 28, 2024

You need to add option - line 832
and test on 4k display

IMG_20240229_000829_035

@iwbnwif
Copy link
Contributor Author

iwbnwif commented Feb 29, 2024

Unfortunately, I am unable to build on Windows at the moment. Previously @ra3xdh made binary available - is it possible to do that again?

@iwbnwif
Copy link
Contributor Author

iwbnwif commented Apr 19, 2024

Just to let you know, 24.2.1 is still overscaled.

Is it possible to add setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Floor) or setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor) in the next Windows build?

I don't think this will have any detrimental affect on non-4K displays.

@zergud
Copy link
Collaborator

zergud commented Apr 19, 2024

Some "detrimental affect on non-4K display" appears when set scale 1.5 for example.. menu items overlaps etc.

@ra3xdh
Copy link
Owner

ra3xdh commented Apr 20, 2024

Maybe switching Windows build to Qt6 will resolve this problem? I am considering this option since the next release.

@iwbnwif
Copy link
Contributor Author

iwbnwif commented Apr 20, 2024

Some "detrimental affect on non-4K display" appears when set scale 1.5 for example.. menu items overlaps etc.

I see - I tried 1.25 on non-4k and it seemed to be okay. Perhaps the best thing would be to include it as an optional setting?

I will try to setup a build environment on Windows so I can better test this and create a PR.

@iwbnwif
Copy link
Contributor Author

iwbnwif commented Apr 20, 2024

I can confirm that setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Floor) works on Windows 11 4k displays with 150% scale factor.

There are some small artefacts, for example the simulation tool drop down on the toolbar is too small to fit "Qucsator" and the Thickness value in the Edit Diagram properties box only shows half a number. Nonetheless, the application is much more useable than without the setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants