labscript-suite / labscript-utils

Shared modules used by the 𝘭𝘒𝘣𝘴𝘀𝘳π˜ͺ𝘱𝘡 𝘴𝘢π˜ͺ𝘡𝘦. Includes a graphical exception handler, debug tools, configuration management, cross platform filepath conversions, unit conversions and custom GUI widgets.
http://labscriptsuite.org
Other
2 stars 45 forks source link

Set some Qt settings to play nicer on High DPI displays #96

Closed chrisjbillington closed 1 year ago

chrisjbillington commented 1 year ago

labscript_utils.splash is the first place a QApplication gets created for all of our apps. So setting these settings there applies them to all our applications, although they are also needed for the splash screen itself to be scaled better on High DPI displays.

AA_EnableHighDpiScaling scales all pixel metrics to the device pixel ratio - so this means curved edges and padding and whatnot get scaled up, as well as the size of some pixmaps.

AA_UseHighDpiPixmaps means to use high DPI pixmaps for icons etc, directly, rather than rendering them at the lower resolution and then scaling them up (not sure why anyone would want the latter behaviour). Strangely, high resolution pixmaps are used when AA_EnableHighDpiScaling is off. It's only when it is turned on that they get downscaled and then upscaled again and end up blocky.

Before:

image

After:

image

There are some other places where is it maybe more obvious like this tiny icon in BLACS:

image

Which is full-sized after these changes:

image

With higher resolution icons in qtutils now, things should be pretty good on High DPI displays.

chrisjbillington commented 1 year ago

I haven't actually tested this on Windows yet. I'll do so at some point, or anyone should feel free to beat me to it.

dihm commented 1 year ago

I can confirm this works on Windows. For me, it appears this also scales up the font sizes of most things, meaning that the minimum sizes of some widgets are different. The digital buttons are the most notable for me.

Before: image

After: image

Relative scales in these screen clips appear to be accurate. Probably not a fundamental issue, but I can imagine some users with a ton of tabs and a big screen may get annoyed when their layout options change.

As a fun note, it appears the restored windows size (ie you ran BLACS before implementing this PR) scales up as well. People may be in for a fun surprise when updating when everything is suddenly huge.

Overall, I like this change. We like using giant screens with high resolution. This definitely makes it easier to see things.

dihm commented 1 year ago

@chrisjbillington Do you think this is ready to merge? I'm hoping to include it in the next release (which will let me push labscript-suite v3.2.0 with full Python 3.10 & 3.11 support).

chrisjbillington commented 1 year ago

Yep, I'm happy let's do it.

Thanks for all the work getting the latest releases happening!